first commit
This commit is contained in:
25
Assets/Scripts/UI/CommonInput.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/CommonInput.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonInput
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7pt33p1dk";
|
||||
|
||||
public GTextInput Input;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
Input = (GTextInput)GetChild("Input");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/CommonInput.Designer.cs.meta
Normal file
11
Assets/Scripts/UI/CommonInput.Designer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 397715486f459df4683b985670459589
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/Scripts/UI/CommonInput.cs
Normal file
15
Assets/Scripts/UI/CommonInput.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class CommonInput : GLabel
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/CommonInput.cs.meta
Normal file
11
Assets/Scripts/UI/CommonInput.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31ed50c89ea383a44a5a614c8dffb65d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/Scripts/UI/LoginPanel.Designer.cs
generated
Normal file
34
Assets/Scripts/UI/LoginPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,34 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class LoginPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "LoginPanel";
|
||||
|
||||
[AutoFind(Name = "InputServer")]
|
||||
public CommonInput InputServer;
|
||||
[AutoFind(Name = "InputPass")]
|
||||
public CommonInput InputPass;
|
||||
[AutoFind(Name = "BtnLogin")]
|
||||
public GButton BtnLogin;
|
||||
[AutoFind(Name = "GoupS")]
|
||||
public GGroup GoupS;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<LoginPanel>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<LoginPanel>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<LoginPanel>(); }
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/LoginPanel.Designer.cs.meta
Normal file
11
Assets/Scripts/UI/LoginPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d14502d04aeecf4c9554d7c5c01f9ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
79
Assets/Scripts/UI/LoginPanel.cs
Normal file
79
Assets/Scripts/UI/LoginPanel.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class LoginPanel : UIPanel
|
||||
{
|
||||
private string serverUrl;
|
||||
private string serverPassword;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
this.AutoAddClick(OnClick);
|
||||
}
|
||||
|
||||
protected override void OnShowed()
|
||||
{
|
||||
InputServer.Input.promptText = "请输入服务器地址";
|
||||
InputPass.Input.promptText = "请输入服务器密码";
|
||||
|
||||
serverUrl = PlayerPrefs.GetString("serverUrl", string.Empty);
|
||||
serverPassword = PlayerPrefs.GetString("serverPassword", string.Empty);
|
||||
InputServer.Input.text = serverUrl;
|
||||
InputPass.Input.text = serverPassword;
|
||||
if (!string.IsNullOrEmpty(serverUrl) && !string.IsNullOrEmpty(serverPassword))
|
||||
{
|
||||
Connect();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClick(GComponent btn)
|
||||
{
|
||||
if (btn == BtnLogin)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(InputPass.Input.text))
|
||||
{
|
||||
serverPassword = InputPass.Input.text;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(InputServer.Input.text))
|
||||
{
|
||||
serverUrl = InputServer.Input.text;
|
||||
}
|
||||
|
||||
Connect();
|
||||
// Notices.Show("测试========----------的首发式地方");
|
||||
// MessageBox.ShowMessage("啊撒旦立刻就了",(b =>
|
||||
// {
|
||||
// Log.Info($"b={b}");
|
||||
// }));
|
||||
}
|
||||
}
|
||||
|
||||
private void Connect()
|
||||
{
|
||||
Net.Instance.SetServer(serverUrl, serverPassword);
|
||||
|
||||
PlayerPrefs.SetString("serverUrl", serverUrl);
|
||||
PlayerPrefs.SetString("serverPassword", serverPassword);
|
||||
|
||||
Game.Instance.Tick((ret) =>
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
PlayerPanel.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.ShowMessage("无法连接服务器,请检查服务器信息\n格式:192.168.0.120:9888", null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/LoginPanel.cs.meta
Normal file
11
Assets/Scripts/UI/LoginPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 763778556eedb4c4db6ddbccc365b5bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/Scripts/UI/MainBinder.cs
Normal file
17
Assets/Scripts/UI/MainBinder.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
/**注册组件绑定关系。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public static class MainBinder
|
||||
{
|
||||
[UIExtensionAutoBind]
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(CommonInput.URL, typeof(CommonInput));
|
||||
UIObjectFactory.SetPackageItemExtension(PlayerBottomInfo.URL, typeof(PlayerBottomInfo));
|
||||
UIObjectFactory.SetPackageItemExtension(VideoPlayer.URL, typeof(VideoPlayer));
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/MainBinder.cs.meta
Normal file
11
Assets/Scripts/UI/MainBinder.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb0005250d3018046b031c10885e989b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/Scripts/UI/MessageBox.Designer.cs
generated
Normal file
40
Assets/Scripts/UI/MessageBox.Designer.cs
generated
Normal file
@@ -0,0 +1,40 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class MessageBox
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "MessageBox";
|
||||
|
||||
[AutoFind(Name = "MessageStyle")]
|
||||
public Controller MessageStyle;
|
||||
[AutoFind(Name = "back")]
|
||||
public GImage back;
|
||||
[AutoFind(Name = "TextDesc")]
|
||||
public GTextField TextDesc;
|
||||
[AutoFind(Name = "BtnCancel")]
|
||||
public GButton BtnCancel;
|
||||
[AutoFind(Name = "BtnConfirm")]
|
||||
public GButton BtnConfirm;
|
||||
[AutoFind(Name = "TextTitle")]
|
||||
public GTextField TextTitle;
|
||||
[AutoFind(Name = "t0")]
|
||||
public Transition t0;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<MessageBox>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<MessageBox>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<MessageBox>(); }
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/MessageBox.Designer.cs.meta
Normal file
11
Assets/Scripts/UI/MessageBox.Designer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b76fee6926b07749bcc390f24951f82
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
71
Assets/Scripts/UI/MessageBox.cs
Normal file
71
Assets/Scripts/UI/MessageBox.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class MessageBox : UIPanel
|
||||
{
|
||||
private static string _confirmText;
|
||||
private static string _cancelText;
|
||||
private static string _title;
|
||||
private static string _content;
|
||||
private static Action<bool> _callback = null;
|
||||
private static int _style;
|
||||
|
||||
public static void ShowMessage(string msg, Action<bool> callback, string title = "", int style = 0,
|
||||
string confirmText = "", string cancelText = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
title = "提示";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(confirmText))
|
||||
{
|
||||
confirmText = "确定";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(cancelText))
|
||||
{
|
||||
cancelText = "取消";
|
||||
}
|
||||
|
||||
_confirmText = confirmText;
|
||||
_cancelText = cancelText;
|
||||
_callback = callback;
|
||||
_content = msg;
|
||||
_title = title;
|
||||
_style = style;
|
||||
UI.Inst.OpenUI<MessageBox>();
|
||||
}
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
this.AutoAddClick(OnClick);
|
||||
IsModal = true;
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
// Modal.SetTitle(_title);
|
||||
TextTitle.text = _title;
|
||||
BtnConfirm.title = _confirmText;
|
||||
BtnCancel.title = _cancelText;
|
||||
TextDesc.text = _content;
|
||||
MessageStyle.selectedIndex = _style;
|
||||
}
|
||||
|
||||
private void OnClick(GComponent btn)
|
||||
{
|
||||
var ret = btn == BtnConfirm;
|
||||
UI.Inst.DestroyUI<MessageBox>();
|
||||
_callback?.Invoke(ret);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/MessageBox.cs.meta
Normal file
11
Assets/Scripts/UI/MessageBox.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69d08638cf4f6d949aa488ef60d0b6d3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/Scripts/UI/Notices.Designer.cs
generated
Normal file
28
Assets/Scripts/UI/Notices.Designer.cs
generated
Normal file
@@ -0,0 +1,28 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class Notices
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "Notices";
|
||||
|
||||
[AutoFind(Name = "show")]
|
||||
public Controller show;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<Notices>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<Notices>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<Notices>(); }
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Notices.Designer.cs.meta
Normal file
11
Assets/Scripts/UI/Notices.Designer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3afa950674d2148498d144e87d9abeea
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
141
Assets/Scripts/UI/Notices.cs
Normal file
141
Assets/Scripts/UI/Notices.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class Notices : UIPanel
|
||||
{
|
||||
private static bool _isOpen;
|
||||
private static readonly Queue<string> MsgArr = new();
|
||||
private GObjectPool _noticePool;
|
||||
private string _itemUrl;
|
||||
private float _startY;
|
||||
private const int LimitCount = 3; //显示条数上限
|
||||
|
||||
public static void Show(string msg)
|
||||
{
|
||||
if (string.IsNullOrEmpty(msg)) return;
|
||||
Log.Info($"显示一个notice={msg}");
|
||||
if (!_isOpen)
|
||||
{
|
||||
UI.Inst.OpenUI<Notices>();
|
||||
}
|
||||
|
||||
MsgArr.Enqueue(msg);
|
||||
}
|
||||
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
ContentPane.sortingOrder = UIDef.UIOrder.Notices;
|
||||
_startY = GRoot.inst.height / 2;
|
||||
_itemUrl = UIPackage.GetItemURL(UIDef.Pack.Main, "NoticeItem");
|
||||
_noticePool = new GObjectPool(ContentPane.container.cachedTransform);
|
||||
|
||||
MonoManager.Inst.OnUpdate += OnUpdate;
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
_isOpen = true;
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
if (MsgArr.Count > 0)
|
||||
{
|
||||
var msg = MsgArr.Dequeue();
|
||||
ShowOnceNotice(msg);
|
||||
//旧的向上移动
|
||||
var count = ContentPane.numChildren - 1;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
GObject obj = ContentPane.GetChildAt(i);
|
||||
if (obj != null)
|
||||
{
|
||||
SetObjRise(obj);
|
||||
}
|
||||
}
|
||||
|
||||
RemoveLimitMsg();
|
||||
}
|
||||
}
|
||||
|
||||
//region notice
|
||||
private void ShowOnceNotice(string msg)
|
||||
{
|
||||
var item = GetFromPool(_itemUrl).asLabel;
|
||||
item.title = msg;
|
||||
item.x = 0;
|
||||
|
||||
item.y = _startY;
|
||||
item.alpha = 1;
|
||||
//显示在固定区域 两秒后消失
|
||||
item.TweenFade(0, 0.5f).SetDelay(2).OnComplete(() => { ReturnToPool(item); });
|
||||
}
|
||||
|
||||
private void SetObjRise(GObject item)
|
||||
{
|
||||
item.TweenMoveY(item.y - item.height - 10, 0.2f).SetEase(EaseType.QuintInOut);
|
||||
}
|
||||
|
||||
private void RemoveLimitMsg()
|
||||
{
|
||||
var count = ContentPane.numChildren;
|
||||
if (count > LimitCount)
|
||||
{
|
||||
for (int i = 0; i < count - LimitCount; i++)
|
||||
{
|
||||
GObject obj = ContentPane.GetChildAt(i);
|
||||
if (obj != null)
|
||||
{
|
||||
if (GTween.IsTweening(obj))
|
||||
{
|
||||
GTween.Kill(obj, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReturnToPool(obj);
|
||||
}
|
||||
// TweenManager.KillTweens(obj, TweenPropType.Alpha, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private GObject GetFromPool(string url)
|
||||
{
|
||||
var ret = _noticePool.GetObject(url);
|
||||
if (ret == null) return null;
|
||||
ret.visible = true;
|
||||
ContentPane.AddChild(ret);
|
||||
GTween.GetTween(ret, TweenPropType.Y)?.Kill();
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void ReturnToPool(GObject obj)
|
||||
{
|
||||
ContentPane.RemoveChild(obj);
|
||||
_noticePool.ReturnObject(obj);
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
_isOpen = false;
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
_noticePool.Clear();
|
||||
MonoManager.Inst.OnUpdate -= OnUpdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/Notices.cs.meta
Normal file
11
Assets/Scripts/UI/Notices.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f544db4984609aa48b2e36d988acedc3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
27
Assets/Scripts/UI/PlayerBottomInfo.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/PlayerBottomInfo.Designer.cs
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class PlayerBottomInfo
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7pt33p1ha";
|
||||
|
||||
public GTextField TextName;
|
||||
public GTextField TextDesc;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
TextName = (GTextField)GetChild("TextName");
|
||||
TextDesc = (GTextField)GetChild("TextDesc");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/PlayerBottomInfo.Designer.cs.meta
Normal file
11
Assets/Scripts/UI/PlayerBottomInfo.Designer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19c34235280ce2c4b8d9550f79432a80
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/Scripts/UI/PlayerBottomInfo.cs
Normal file
15
Assets/Scripts/UI/PlayerBottomInfo.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class PlayerBottomInfo : GLabel
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/PlayerBottomInfo.cs.meta
Normal file
11
Assets/Scripts/UI/PlayerBottomInfo.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b4c74bb43391ce41a9e8b3d93f7283e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/Scripts/UI/PlayerPanel.Designer.cs
generated
Normal file
40
Assets/Scripts/UI/PlayerPanel.Designer.cs
generated
Normal file
@@ -0,0 +1,40 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
/// <summary> </summary>
|
||||
public partial class PlayerPanel
|
||||
{
|
||||
public GObject this[string aKey] => ContentPane.GetChild(aKey);
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "PlayerPanel";
|
||||
|
||||
[AutoFind(Name = "stageCtrl")]
|
||||
public Controller stageCtrl;
|
||||
[AutoFind(Name = "PlayBack")]
|
||||
public GGraph PlayBack;
|
||||
[AutoFind(Name = "Video")]
|
||||
public VideoPlayer Video;
|
||||
[AutoFind(Name = "bottomBack")]
|
||||
public GGraph bottomBack;
|
||||
[AutoFind(Name = "BtnNext")]
|
||||
public GButton BtnNext;
|
||||
[AutoFind(Name = "BtnPrev")]
|
||||
public GButton BtnPrev;
|
||||
[AutoFind(Name = "Progress")]
|
||||
public GProgressBar Progress;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<PlayerPanel>(param); }
|
||||
|
||||
public static void Hide(){ UI.Inst.HideUI<PlayerPanel>(); }
|
||||
|
||||
public static void Del(){ UI.Inst.DestroyUI<PlayerPanel>(); }
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/PlayerPanel.Designer.cs.meta
Normal file
11
Assets/Scripts/UI/PlayerPanel.Designer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46e441eeaaeba504fa4134c97487c80a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Assets/Scripts/UI/PlayerPanel.cs
Normal file
60
Assets/Scripts/UI/PlayerPanel.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class PlayerPanel : UIPanel
|
||||
{
|
||||
private int TryGetTime = 5;
|
||||
|
||||
protected override void OnShowed()
|
||||
{
|
||||
this.AutoAddClick(OnClick);
|
||||
TryGetTime = 5;
|
||||
Progress.max = 1;
|
||||
GetVideoData();
|
||||
stageCtrl.selectedIndex = 0;
|
||||
}
|
||||
|
||||
private void GetVideoData()
|
||||
{
|
||||
Game.Instance.GetList(OnGetList);
|
||||
}
|
||||
|
||||
private void OnGetList()
|
||||
{
|
||||
if (Game.Instance.Videos.Count > 0)
|
||||
{
|
||||
stageCtrl.selectedIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Notices.Show($"没有视频数据!{TryGetTime}秒后重试");
|
||||
Timer.Once(TryGetTime, this, GetVideoData);
|
||||
TryGetTime *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnUpdate()
|
||||
{
|
||||
base.OnUpdate();
|
||||
Progress.value = VideoManager.Instance.PlayProgress;
|
||||
}
|
||||
|
||||
private void OnClick(GComponent btn)
|
||||
{
|
||||
if (btn == BtnNext)
|
||||
{
|
||||
VideoManager.Instance.Next();
|
||||
}
|
||||
else if (btn == BtnPrev)
|
||||
{
|
||||
VideoManager.Instance.Previous();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/PlayerPanel.cs.meta
Normal file
11
Assets/Scripts/UI/PlayerPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82a8b35b414c0034d8515eb7dea6faf2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/UI/UILangeageConfig.cs
Normal file
32
Assets/Scripts/UI/UILangeageConfig.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
/**注册组件多语言绑定。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class UILangeageConfig : UIComponentLanguagePack
|
||||
{
|
||||
public UILangeageConfig()
|
||||
{
|
||||
AddData();
|
||||
}
|
||||
private void AddData()
|
||||
{
|
||||
Add("ui://hxr7rc7poy1y0", new UIComponentLanguage()
|
||||
{
|
||||
{ "n5_ips6", "Text_TEST" },
|
||||
}
|
||||
);
|
||||
Add("ui://hxr7rc7pfhdrzd", new UIComponentLanguage()
|
||||
{
|
||||
{ "n12_t33p", "请输入账号" },
|
||||
{ "n13_t33p", "请输入密码" },
|
||||
{ "n10_t33p", "请输入服务器地址" },
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/UILangeageConfig.cs.meta
Normal file
11
Assets/Scripts/UI/UILangeageConfig.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4576ce69defc844f8a59bf1497de6c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/Scripts/UI/UITweenConfig.cs
Normal file
34
Assets/Scripts/UI/UITweenConfig.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
/**注册组件动效绑定。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class UITweenConfig : UIComponentTweenPack
|
||||
{
|
||||
public UITweenConfig()
|
||||
{
|
||||
AddData();
|
||||
}
|
||||
|
||||
private void AddData()
|
||||
{
|
||||
// Common
|
||||
Add("ui://6hgkvlauips61", new UIComponentTween()
|
||||
{
|
||||
{ "__root__", "Fade" },
|
||||
}
|
||||
);
|
||||
|
||||
// Main
|
||||
Add("ui://hxr7rc7pt33p1hd", new UIComponentTween()
|
||||
{
|
||||
{ "__root__", "Scale" },
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/UITweenConfig.cs.meta
Normal file
11
Assets/Scripts/UI/UITweenConfig.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 103e7349cfac0224ca8fa3aa43fe4f55
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Assets/Scripts/UI/VideoPlayer.Designer.cs
generated
Normal file
37
Assets/Scripts/UI/VideoPlayer.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class VideoPlayer
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7pt33p1hg";
|
||||
|
||||
public Controller pauseCtrl;
|
||||
public GGraph PlayBack;
|
||||
public GLoader VideoVer;
|
||||
public GComponent BtnPause;
|
||||
public Transition pause;
|
||||
public Transition play;
|
||||
public Transition StartedAnim;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
pauseCtrl = GetController("pauseCtrl");
|
||||
PlayBack = (GGraph)GetChild("PlayBack");
|
||||
VideoVer = (GLoader)GetChild("VideoVer");
|
||||
BtnPause = (GComponent)GetChild("BtnPause");
|
||||
pause = GetTransition("pause");
|
||||
play = GetTransition("play");
|
||||
StartedAnim = GetTransition("StartedAnim");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/VideoPlayer.Designer.cs.meta
Normal file
11
Assets/Scripts/UI/VideoPlayer.Designer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50f3a357e72b4134bb6aa8f1b3b6fa47
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
132
Assets/Scripts/UI/VideoPlayer.cs
Normal file
132
Assets/Scripts/UI/VideoPlayer.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
using RenderHeads.Media.AVProVideo;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class VideoPlayer : GComponent
|
||||
{
|
||||
private NTexture _texture;
|
||||
private float _defY;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
VideoManager.Instance.OnPlayStart += OnPlayStart;
|
||||
VideoManager.Instance.OnHandleEvent += OnHandleEvent;
|
||||
BtnPause.onClick.Set(OnClickPause);
|
||||
|
||||
SwipeGesture gesture = new SwipeGesture(BtnPause);
|
||||
gesture.onBegin.Set(OnSwipeBegin);
|
||||
gesture.onMove.Set(OnSwipeMove);
|
||||
gesture.onEnd.Set(OnSwipeEnd);
|
||||
gesture.onAction.Add(OnSwipeGesture);
|
||||
_defY = VideoVer.y;
|
||||
// Video.texture = new NTexture(Game.Instance.RT);
|
||||
// Player.on
|
||||
// Player.OpenMedia()
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
VideoManager.Instance.OnPlayStart -= OnPlayStart;
|
||||
VideoManager.Instance.OnHandleEvent -= OnHandleEvent;
|
||||
if (_texture != null)
|
||||
{
|
||||
_texture.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#region 手势
|
||||
|
||||
private float _offsetValue;
|
||||
|
||||
private void OnSwipeBegin(EventContext context)
|
||||
{
|
||||
}
|
||||
|
||||
private void OnSwipeMove(EventContext context)
|
||||
{
|
||||
var gesture = context.sender as SwipeGesture;
|
||||
if (gesture == null) return;
|
||||
Log.Info($"gesture.delta.y={gesture.delta.y}");
|
||||
_offsetValue += gesture.delta.y;
|
||||
VideoVer.y = _defY + _offsetValue;
|
||||
}
|
||||
|
||||
private void OnSwipeEnd(EventContext context)
|
||||
{
|
||||
_offsetValue = 0;
|
||||
VideoVer.y = _defY;
|
||||
}
|
||||
|
||||
private void OnSwipeGesture(EventContext context)
|
||||
{
|
||||
SwipeGesture swipeGesture = (SwipeGesture)context.sender;
|
||||
var value = Math.Abs(swipeGesture.position.y);
|
||||
if (value < 200)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (swipeGesture.position.y < 0) //向上滑动
|
||||
{
|
||||
Log.Info($"向上滑动 y={swipeGesture.position.y}");
|
||||
VideoManager.Instance.Next();
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Info($"向下滑动 y={swipeGesture.position.y}");
|
||||
VideoManager.Instance.Previous();
|
||||
}
|
||||
|
||||
VideoVer.alpha = 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private void OnHandleEvent(MediaPlayerEvent.EventType eventType)
|
||||
{
|
||||
if (eventType == MediaPlayerEvent.EventType.Paused)
|
||||
{
|
||||
// pauseCtrl.selectedIndex = 1;
|
||||
}
|
||||
// else if (eventType == MediaPlayerEvent.EventType.Unpaused ||
|
||||
// eventType == MediaPlayerEvent.EventType.Started)
|
||||
// {
|
||||
// // pauseCtrl.selectedIndex = 0;
|
||||
// }
|
||||
else if (eventType == MediaPlayerEvent.EventType.Started)
|
||||
{
|
||||
StartedAnim.Play();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlayStart(RenderTexture rt)
|
||||
{
|
||||
if (_texture != null)
|
||||
{
|
||||
_texture.Dispose();
|
||||
}
|
||||
|
||||
_texture = new NTexture(rt);
|
||||
VideoVer.texture = _texture;
|
||||
}
|
||||
|
||||
|
||||
#region 播放控制
|
||||
|
||||
private void OnClickPause()
|
||||
{
|
||||
VideoManager.Instance.TogglePlayPause();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/UI/VideoPlayer.cs.meta
Normal file
11
Assets/Scripts/UI/VideoPlayer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1edbb7a293272794ea2e17952cb25b96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user