forked from sin365/AxibugEmuOnline
Merge pull request 'master' (#84) from Alienjack/AxibugEmuOnline:master into master
Reviewed-on: sin365/AxibugEmuOnline#84
This commit is contained in:
commit
ba93b5747b
@ -6,7 +6,6 @@ using System.Collections;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
|
||||||
using static AxibugEmuOnline.Client.HttpAPI;
|
using static AxibugEmuOnline.Client.HttpAPI;
|
||||||
using static AxibugEmuOnline.Client.Manager.LogManager;
|
using static AxibugEmuOnline.Client.Manager.LogManager;
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ namespace AxibugEmuOnline.Client.ClientCore
|
|||||||
#else
|
#else
|
||||||
public static string PersistentDataPath => Application.persistentDataPath;
|
public static string PersistentDataPath => Application.persistentDataPath;
|
||||||
#endif
|
#endif
|
||||||
public static void Init( bool isTest = false, string testSrvIP = "")
|
public static void Init(bool isTest = false, string testSrvIP = "")
|
||||||
{
|
{
|
||||||
log = new LogManager(OnLogOut);
|
log = new LogManager(OnLogOut);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,76 +1,76 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static AxiHttp;
|
using static AxiHttp;
|
||||||
|
|
||||||
public static class AxiHttpProxy
|
public static class AxiHttpProxy
|
||||||
{
|
{
|
||||||
public static SendWebRequestProxy Get(string url)
|
public static SendWebRequestProxy Get(string url)
|
||||||
{
|
{
|
||||||
return new SendWebRequestProxy(AxiRequestAsync(url));
|
return new SendWebRequestProxy(AxiRequestAsync(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SendDownLoadProxy GetDownLoad(string url)
|
public static SendDownLoadProxy GetDownLoad(string url)
|
||||||
{
|
{
|
||||||
return new SendDownLoadProxy(AxiDownloadAsync(url));
|
return new SendDownLoadProxy(AxiDownloadAsync(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SendWebRequestProxy
|
public class SendWebRequestProxy
|
||||||
{
|
{
|
||||||
public WaitAxiRequest SendWebRequest;
|
public WaitAxiRequest SendWebRequest;
|
||||||
public AxiRespInfo downloadHandler => SendWebRequest.mReqAsync;
|
public AxiRespInfo downloadHandler => SendWebRequest.mReqAsync;
|
||||||
public SendWebRequestProxy(WaitAxiRequest request)
|
public SendWebRequestProxy(WaitAxiRequest request)
|
||||||
{
|
{
|
||||||
SendWebRequest = request;
|
SendWebRequest = request;
|
||||||
}
|
}
|
||||||
~SendWebRequestProxy()
|
~SendWebRequestProxy()
|
||||||
{
|
{
|
||||||
SendWebRequest = null;
|
SendWebRequest = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SendDownLoadProxy
|
public class SendDownLoadProxy
|
||||||
{
|
{
|
||||||
public AxiRespInfo downloadHandler;
|
public AxiRespInfo downloadHandler;
|
||||||
public SendDownLoadProxy(AxiRespInfo re)
|
public SendDownLoadProxy(AxiRespInfo re)
|
||||||
{
|
{
|
||||||
downloadHandler = re;
|
downloadHandler = re;
|
||||||
}
|
}
|
||||||
~SendDownLoadProxy()
|
~SendDownLoadProxy()
|
||||||
{
|
{
|
||||||
downloadHandler = null;
|
downloadHandler = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void ShowAxiHttpDebugInfo(AxiRespInfo resp)
|
public static void ShowAxiHttpDebugInfo(AxiRespInfo resp)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
Debug.Log($"");
|
Debug.Log($"");
|
||||||
Debug.Log($"==== request ====");
|
Debug.Log($"==== request ====");
|
||||||
Debug.Log($"url =>{resp.url}");
|
Debug.Log($"url =>{resp.url}");
|
||||||
Debug.Log($"Raw =>{resp.requestRaw}");
|
Debug.Log($"Raw =>{resp.requestRaw}");
|
||||||
Debug.Log($"code =>{resp.code}");
|
Debug.Log($"code =>{resp.code}");
|
||||||
Debug.Log($"respInfo.bTimeOut =>{resp.bTimeOut}");
|
Debug.Log($"respInfo.bTimeOut =>{resp.bTimeOut}");
|
||||||
Debug.Log($"");
|
Debug.Log($"");
|
||||||
Debug.Log($"==== response ====");
|
Debug.Log($"==== response ====");
|
||||||
Debug.Log($"==== header ====");
|
Debug.Log($"==== header ====");
|
||||||
Debug.Log($"header =>{resp.header}");
|
Debug.Log($"header =>{resp.header}");
|
||||||
Debug.Log($"HeadersCount =>{resp.headers.Count}");
|
Debug.Log($"HeadersCount =>{resp.headers.Count}");
|
||||||
foreach (var kv in resp.headers)
|
foreach (var kv in resp.headers)
|
||||||
Debug.Log($"{kv.Key} => {kv.Value}");
|
Debug.Log($"{kv.Key} => {kv.Value}");
|
||||||
Debug.Log($"");
|
Debug.Log($"");
|
||||||
Debug.Log($"==== body ====");
|
Debug.Log($"==== body ====");
|
||||||
Debug.Log($"body_text =>{resp.body}");
|
Debug.Log($"body_text =>{resp.body}");
|
||||||
Debug.Log($"body_text.Length =>{resp.body.Length}");
|
Debug.Log($"body_text.Length =>{resp.body.Length}");
|
||||||
Debug.Log($"bodyRaw.Length =>{resp.bodyRaw?.Length}");
|
Debug.Log($"bodyRaw.Length =>{resp.bodyRaw?.Length}");
|
||||||
Debug.Log($"");
|
Debug.Log($"");
|
||||||
Debug.Log($"==== download ====");
|
Debug.Log($"==== download ====");
|
||||||
Debug.Log($"downloadMode =>{resp.downloadMode}");
|
Debug.Log($"downloadMode =>{resp.downloadMode}");
|
||||||
Debug.Log($"respInfo.fileName =>{resp.fileName}");
|
Debug.Log($"respInfo.fileName =>{resp.fileName}");
|
||||||
Debug.Log($"respInfo.NeedloadedLenght =>{resp.NeedloadedLenght}");
|
Debug.Log($"respInfo.NeedloadedLenght =>{resp.NeedloadedLenght}");
|
||||||
Debug.Log($"respInfo.loadedLenght =>{resp.loadedLenght}");
|
Debug.Log($"respInfo.loadedLenght =>{resp.loadedLenght}");
|
||||||
#else
|
#else
|
||||||
Debug.Log($"==== request url => { resp.url}");
|
Debug.Log($"==== request url => { resp.url}");
|
||||||
Debug.Log($"code =>{resp.code}");
|
Debug.Log($"code =>{resp.code}");
|
||||||
@ -87,33 +87,33 @@ public static class AxiHttpProxy
|
|||||||
Debug.Log($"respInfo.loadedLenght =>{resp.loadedLenght}");
|
Debug.Log($"respInfo.loadedLenght =>{resp.loadedLenght}");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//if (resp.downloadMode == AxiDownLoadMode.DownLoadBytes)
|
//if (resp.downloadMode == AxiDownLoadMode.DownLoadBytes)
|
||||||
//{
|
//{
|
||||||
// if (resp.bTimeOut)
|
// if (resp.bTimeOut)
|
||||||
// {
|
// {
|
||||||
// Debug.Log($"DownLoad Timeout!");
|
// Debug.Log($"DownLoad Timeout!");
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// string downloadSavePath;
|
// string downloadSavePath;
|
||||||
// if (Application.platform == RuntimePlatform.PSP2)
|
// if (Application.platform == RuntimePlatform.PSP2)
|
||||||
// {
|
// {
|
||||||
// downloadSavePath = dataAxibugPath + "/" + resp.fileName;
|
// downloadSavePath = dataAxibugPath + "/" + resp.fileName;
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// downloadSavePath = persistentDataPath + "/" + resp.fileName;
|
// downloadSavePath = persistentDataPath + "/" + resp.fileName;
|
||||||
// }
|
// }
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
// File.WriteAllBytes(downloadSavePath, resp.bodyRaw);
|
// File.WriteAllBytes(downloadSavePath, resp.bodyRaw);
|
||||||
// Debug.Log($"DownLoad OK");
|
// Debug.Log($"DownLoad OK");
|
||||||
// }
|
// }
|
||||||
// catch (Exception ex)
|
// catch (Exception ex)
|
||||||
// {
|
// {
|
||||||
// Debug.Log($"DownLoad Err {ex.ToString()}");
|
// Debug.Log($"DownLoad Err {ex.ToString()}");
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -12,10 +12,10 @@ namespace AxibugEmuOnline.Client
|
|||||||
public static string dev_UUID;
|
public static string dev_UUID;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
GameObject IMPORTENT;
|
GameObject IMPORTENT;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
public bool bTest = false;
|
public bool bTest = false;
|
||||||
public string mTestSrvIP = "192.168.0.47";
|
public string mTestSrvIP = "192.168.0.47";
|
||||||
|
@ -432,7 +432,7 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
/// 发送修改玩家槽位,全量
|
/// 发送修改玩家槽位,全量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dictSlotIdx2LocalJoyIdx">玩家占用房间GamePlaySlot和LocalJoyIdx字典</param>
|
/// <param name="dictSlotIdx2LocalJoyIdx">玩家占用房间GamePlaySlot和LocalJoyIdx字典</param>
|
||||||
public void SendChangePlaySlotIdxWithJoyIdx(Dictionary<uint, ValueTuple<uint,GamePadType>> dictSlotIdx2LocalJoyIdx)
|
public void SendChangePlaySlotIdxWithJoyIdx(Dictionary<uint, ValueTuple<uint, GamePadType>> dictSlotIdx2LocalJoyIdx)
|
||||||
{
|
{
|
||||||
if (!InRoom)
|
if (!InRoom)
|
||||||
return;
|
return;
|
||||||
@ -617,7 +617,7 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
public static bool GetPlayerGamePadTypeByPlayerIdx(this Protobuf_Room_MiniInfo roomMiniInfo, uint GameSlotIdx, out GamePadType gamePadType)
|
public static bool GetPlayerGamePadTypeByPlayerIdx(this Protobuf_Room_MiniInfo roomMiniInfo, uint GameSlotIdx, out GamePadType gamePadType)
|
||||||
{
|
{
|
||||||
if (roomMiniInfo.GamePlaySlotList[(int)GameSlotIdx].PlayerUID > 0)
|
if (roomMiniInfo.GamePlaySlotList[(int)GameSlotIdx].PlayerUID > 0)
|
||||||
{
|
{
|
||||||
gamePadType = roomMiniInfo.GamePlaySlotList[(int)GameSlotIdx].PlayerLocalGamePadType;
|
gamePadType = roomMiniInfo.GamePlaySlotList[(int)GameSlotIdx].PlayerLocalGamePadType;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using AxibugEmuOnline.Client;
|
using AxibugEmuOnline.Client;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Rendering;
|
|
||||||
|
|
||||||
public class Filter1990_esque : FilterEffect
|
public class Filter1990_esque : FilterEffect
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using Assets.Script.AppMain.Filter;
|
using Assets.Script.AppMain.Filter;
|
||||||
using AxibugEmuOnline.Client;
|
using AxibugEmuOnline.Client;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Experimental.Rendering;
|
using UnityEngine.Experimental.Rendering;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Assets.Script.AppMain.Filter
|
namespace Assets.Script.AppMain.Filter
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
{
|
{
|
||||||
@ -26,8 +25,8 @@ namespace AxibugEmuOnline.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator DownloadFromURL(string url, string path, Action<byte[]> callback)
|
IEnumerator DownloadFromURL(string url, string path, Action<byte[]> callback)
|
||||||
{
|
{
|
||||||
AxiHttpProxy.SendDownLoadProxy request = AxiHttpProxy.GetDownLoad($"{App.httpAPI.WebHost}/{url}");
|
AxiHttpProxy.SendDownLoadProxy request = AxiHttpProxy.GetDownLoad($"{App.httpAPI.WebHost}/{url}");
|
||||||
|
|
||||||
while (!request.downloadHandler.isDone)
|
while (!request.downloadHandler.isDone)
|
||||||
{
|
{
|
||||||
@ -61,14 +60,14 @@ namespace AxibugEmuOnline.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<string, object> cachesInMemory = new Dictionary<string, object>();
|
private Dictionary<string, object> cachesInMemory = new Dictionary<string, object>();
|
||||||
void GetCacheData<T>(string url, string path, Action<T, string> callback) where T : class
|
void GetCacheData<T>(string url, string path, Action<T, string> callback) where T : class
|
||||||
{
|
{
|
||||||
object cacheObj;
|
object cacheObj;
|
||||||
|
|
||||||
if (cachesInMemory.TryGetValue(url, out cacheObj) && cacheObj is T)
|
if (cachesInMemory.TryGetValue(url, out cacheObj) && cacheObj is T)
|
||||||
{
|
{
|
||||||
T obj = (T)cacheObj;
|
T obj = (T)cacheObj;
|
||||||
callback.Invoke(obj, url);
|
callback.Invoke(obj, url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugProtobuf;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
@ -18,14 +16,14 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
public void GetNesRomList(Action<int, Resp_GameList> callback, AxibugProtobuf.RomPlatformType platform, int page, int pageSize = 10)
|
public void GetNesRomList(Action<int, Resp_GameList> callback, AxibugProtobuf.RomPlatformType platform, int page, int pageSize = 10)
|
||||||
{
|
{
|
||||||
App.StartCoroutine(GetRomListFlow(platform,page, pageSize, callback));
|
App.StartCoroutine(GetRomListFlow(platform, page, pageSize, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SearchNesRomList(Action<int, Resp_GameList> callback, AxibugProtobuf.RomPlatformType platform, string searchKey, int page, int pageSize = 10)
|
public void SearchNesRomList(Action<int, Resp_GameList> callback, AxibugProtobuf.RomPlatformType platform, string searchKey, int page, int pageSize = 10)
|
||||||
{
|
{
|
||||||
App.StartCoroutine(SearchNesRomListFlow(platform,searchKey, page, pageSize, callback));
|
App.StartCoroutine(SearchNesRomListFlow(platform, searchKey, page, pageSize, callback));
|
||||||
}
|
}
|
||||||
private IEnumerator SearchNesRomListFlow(AxibugProtobuf.RomPlatformType platform,string searchKey, int page, int pageSize, Action<int, Resp_GameList> callback)
|
private IEnumerator SearchNesRomListFlow(AxibugProtobuf.RomPlatformType platform, string searchKey, int page, int pageSize, Action<int, Resp_GameList> callback)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(searchKey))
|
if (!string.IsNullOrEmpty(searchKey))
|
||||||
{
|
{
|
||||||
|
@ -154,18 +154,18 @@ namespace AxibugEmuOnline.Client.Manager
|
|||||||
for (int i = 0; i < msg.UserList.Count; i++)
|
for (int i = 0; i < msg.UserList.Count; i++)
|
||||||
{
|
{
|
||||||
UserMiniInfo mi = msg.UserList[i];
|
UserMiniInfo mi = msg.UserList[i];
|
||||||
bool isNewUser;
|
bool isNewUser;
|
||||||
UpdateOrAddUser(mi, out isNewUser);
|
UpdateOrAddUser(mi, out isNewUser);
|
||||||
}
|
}
|
||||||
Eventer.Instance.PostEvent(EEvent.OnUserListAllUpdate);
|
Eventer.Instance.PostEvent(EEvent.OnUserListAllUpdate);
|
||||||
}
|
}
|
||||||
public void RecvCmdUserJoin(byte[] reqData)
|
public void RecvCmdUserJoin(byte[] reqData)
|
||||||
{
|
{
|
||||||
Protobuf_UserJoin_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_UserJoin_RESP>(reqData);
|
Protobuf_UserJoin_RESP msg = ProtoBufHelper.DeSerizlize<Protobuf_UserJoin_RESP>(reqData);
|
||||||
bool isNewUser;
|
bool isNewUser;
|
||||||
UpdateOrAddUser(msg.UserInfo, out isNewUser);
|
UpdateOrAddUser(msg.UserInfo, out isNewUser);
|
||||||
if (isNewUser)
|
if (isNewUser)
|
||||||
{
|
{
|
||||||
Eventer.Instance.PostEvent(EEvent.OnUserLogin, msg.UserInfo.UID, msg.UserInfo.NickName);
|
Eventer.Instance.PostEvent(EEvent.OnUserLogin, msg.UserInfo.UID, msg.UserInfo.NickName);
|
||||||
OverlayManager.PopTip($"玩家[{msg.UserInfo.NickName}]上线了");
|
OverlayManager.PopTip($"玩家[{msg.UserInfo.NickName}]上线了");
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// StringºÍBoolµÄ·ìºÏ¹Ö
|
/// String和Bool的缝合怪
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct MsgBool
|
public struct MsgBool
|
||||||
{
|
{
|
||||||
public string ErrorMsg;
|
public string ErrorMsg;
|
||||||
public bool Value;
|
public bool Value;
|
||||||
|
|
||||||
//low C# readonly
|
//low C# readonly
|
||||||
//public override readonly string ToString()
|
//public override readonly string ToString()
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
if (Value)
|
if (Value)
|
||||||
{
|
{
|
||||||
@ -34,15 +34,15 @@ public struct MsgBool
|
|||||||
public static implicit operator bool(MsgBool msgBool)
|
public static implicit operator bool(MsgBool msgBool)
|
||||||
{
|
{
|
||||||
return msgBool.Value;
|
return msgBool.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//low C#
|
//low C#
|
||||||
//public static implicit operator (bool, string)(MsgBool msgBool)
|
//public static implicit operator (bool, string)(MsgBool msgBool)
|
||||||
//{
|
//{
|
||||||
// return (msgBool.Value, msgBool.ErrorMsg);
|
// return (msgBool.Value, msgBool.ErrorMsg);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public static implicit operator string(MsgBool msgBool)
|
public static implicit operator string(MsgBool msgBool)
|
||||||
{
|
{
|
||||||
return msgBool.ToString();
|
return msgBool.ToString();
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,10 @@ namespace AxibugEmuOnline.Client
|
|||||||
uint LastTestInput = 0;
|
uint LastTestInput = 0;
|
||||||
public void SampleInput(uint frameIndex)
|
public void SampleInput(uint frameIndex)
|
||||||
{
|
{
|
||||||
if (InGameUI.Instance.IsNetPlay)
|
if (InGameUI.Instance.IsNetPlay)
|
||||||
{
|
{
|
||||||
int targetFrame; ReplayStep replayData; int frameDiff; bool inputDiff;
|
int targetFrame; ReplayStep replayData; int frameDiff; bool inputDiff;
|
||||||
if (App.roomMgr.netReplay.TryGetNextFrame((int)frameIndex, out replayData, out frameDiff, out inputDiff))
|
if (App.roomMgr.netReplay.TryGetNextFrame((int)frameIndex, out replayData, out frameDiff, out inputDiff))
|
||||||
{
|
{
|
||||||
if (inputDiff)
|
if (inputDiff)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.Common;
|
||||||
using AxibugEmuOnline.Client.Common;
|
|
||||||
using AxibugEmuOnline.Client.Event;
|
using AxibugEmuOnline.Client.Event;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -91,7 +90,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
Controller targetController;
|
Controller targetController;
|
||||||
switch (conIndex)
|
switch (conIndex)
|
||||||
{
|
{
|
||||||
case 0: targetController = Controller0;break;
|
case 0: targetController = Controller0; break;
|
||||||
case 1: targetController = Controller1; break;
|
case 1: targetController = Controller1; break;
|
||||||
case 2: targetController = Controller2; break;
|
case 2: targetController = Controller2; break;
|
||||||
case 3: targetController = Controller3; break;
|
case 3: targetController = Controller3; break;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
using System;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
|
using AxibugProtobuf;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using AxibugEmuOnline.Client.ClientCore;
|
|
||||||
using AxibugProtobuf;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VirtualNes.Core;
|
using VirtualNes.Core;
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using VirtualNes.Core;
|
namespace AxibugEmuOnline.Client
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
|
||||||
{
|
{
|
||||||
public static class PaletteDefine
|
public static class PaletteDefine
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ namespace AxibugEmuOnline.Client.Network
|
|||||||
{
|
{
|
||||||
lock (lockQueueObj)
|
lock (lockQueueObj)
|
||||||
{
|
{
|
||||||
queueNetMsg.Enqueue(new ValueTuple<int,int,byte[]>(cmd, ERRCODE, arg));
|
queueNetMsg.Enqueue(new ValueTuple<int, int, byte[]>(cmd, ERRCODE, arg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,9 +75,9 @@ namespace AxibugEmuOnline.Client.Network
|
|||||||
lock (lockQueueObj)
|
lock (lockQueueObj)
|
||||||
{
|
{
|
||||||
while (queueNetMsg.Count > 0)
|
while (queueNetMsg.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
var msgData = queueNetMsg.Dequeue();
|
var msgData = queueNetMsg.Dequeue();
|
||||||
PostNetMsgEvent(msgData.Item1, msgData.Item2, msgData.Item3);
|
PostNetMsgEvent(msgData.Item1, msgData.Item2, msgData.Item3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ namespace AxibugEmuOnline.Client.Network
|
|||||||
ErrorCode err = ((ErrorCode)ERRCODE);
|
ErrorCode err = ((ErrorCode)ERRCODE);
|
||||||
if (err != ErrorCode.ErrorOk)
|
if (err != ErrorCode.ErrorOk)
|
||||||
{
|
{
|
||||||
OverlayManager.PopTip("错误:"+err.ToString());
|
OverlayManager.PopTip("错误:" + err.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Delegate> eventList = GetNetEventDicList(cmd);
|
List<Delegate> eventList = GetNetEventDicList(cmd);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -8,191 +8,191 @@ using static AxibugEmuOnline.Client.FilterManager;
|
|||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 滤镜预览UI
|
/// 滤镜预览UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UI_FilterItem : MenuItem, IVirtualItem
|
public class UI_FilterItem : MenuItem, IVirtualItem
|
||||||
{
|
{
|
||||||
public int Index { get; set; }
|
public int Index { get; set; }
|
||||||
public Filter Datacontext { get; private set; }
|
public Filter Datacontext { get; private set; }
|
||||||
|
|
||||||
public void SetData(object data)
|
public void SetData(object data)
|
||||||
{
|
{
|
||||||
Datacontext = data as Filter;
|
Datacontext = data as Filter;
|
||||||
|
|
||||||
UpdateView();
|
UpdateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateView()
|
private void UpdateView()
|
||||||
{
|
{
|
||||||
if (Datacontext == null)
|
if (Datacontext == null)
|
||||||
SetBaseInfo("无", null, null);
|
SetBaseInfo("无", null, null);
|
||||||
else
|
else
|
||||||
SetBaseInfo(Datacontext.Name, $"参数数量:{Datacontext.Paramerters.Count}", null);
|
SetBaseInfo(Datacontext.Name, $"参数数量:{Datacontext.Paramerters.Count}", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDependencyProperty(object data)
|
public void SetDependencyProperty(object data)
|
||||||
{
|
{
|
||||||
SetSelectState(data is ThirdMenuRoot && ((ThirdMenuRoot)data).SelectIndex == Index);
|
SetSelectState(data is ThirdMenuRoot && ((ThirdMenuRoot)data).SelectIndex == Index);
|
||||||
|
|
||||||
if (m_select)
|
if (m_select)
|
||||||
{
|
{
|
||||||
App.settings.Filter.EnableFilterPreview();
|
App.settings.Filter.EnableFilterPreview();
|
||||||
if (App.settings.Filter != null)
|
if (App.settings.Filter != null)
|
||||||
App.settings.Filter.EnableFilter(Datacontext);
|
App.settings.Filter.EnableFilter(Datacontext);
|
||||||
else
|
else
|
||||||
App.settings.Filter.ShutDownFilter();
|
App.settings.Filter.ShutDownFilter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Release() { }
|
public void Release() { }
|
||||||
|
|
||||||
public override bool OnEnterItem()
|
public override bool OnEnterItem()
|
||||||
{
|
{
|
||||||
if (Datacontext != null && Datacontext.Paramerters.Count > 0)
|
if (Datacontext != null && Datacontext.Paramerters.Count > 0)
|
||||||
{
|
{
|
||||||
var opts = new List<OptionMenu>();
|
var opts = new List<OptionMenu>();
|
||||||
opts.Add(new Opt_CreatePreset(Datacontext));
|
opts.Add(new Opt_CreatePreset(Datacontext));
|
||||||
opts.AddRange(Datacontext.Presets.Select(p => new Opt_Presets(Datacontext, p)));
|
opts.AddRange(Datacontext.Presets.Select(p => new Opt_Presets(Datacontext, p)));
|
||||||
|
|
||||||
OverlayManager.PopSideBar(opts, onClose: () =>
|
OverlayManager.PopSideBar(opts, onClose: () =>
|
||||||
{
|
{
|
||||||
App.settings.Filter.EnableFilterPreview();
|
App.settings.Filter.EnableFilterPreview();
|
||||||
Datacontext.ResetPreset();
|
Datacontext.ResetPreset();
|
||||||
App.settings.Filter.EnableFilter(Datacontext);
|
App.settings.Filter.EnableFilter(Datacontext);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class Opt_CreatePreset : ExecuteMenu
|
public class Opt_CreatePreset : ExecuteMenu
|
||||||
{
|
{
|
||||||
private Filter m_filter;
|
private Filter m_filter;
|
||||||
|
|
||||||
public Opt_CreatePreset(Filter filter) : base("创建滤镜预设", Resources.LoadAll<Sprite>("Icons/XMB-Icons/misc")[0])
|
public Opt_CreatePreset(Filter filter) : base("创建滤镜预设", Resources.LoadAll<Sprite>("Icons/XMB-Icons/misc")[0])
|
||||||
{
|
{
|
||||||
m_filter = filter;
|
m_filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnFocus()
|
public override void OnFocus()
|
||||||
{
|
{
|
||||||
m_filter.ResetPreset();
|
m_filter.ResetPreset();
|
||||||
App.settings.Filter.EnableFilter(m_filter);
|
App.settings.Filter.EnableFilter(m_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnExcute(OptionUI optionUI, ref bool cancelHide)
|
public override void OnExcute(OptionUI optionUI, ref bool cancelHide)
|
||||||
{
|
{
|
||||||
cancelHide = true;
|
cancelHide = true;
|
||||||
|
|
||||||
OverlayManager.Input((presetName) =>
|
OverlayManager.Input((presetName) =>
|
||||||
{
|
{
|
||||||
FilterPreset newPreset;
|
FilterPreset newPreset;
|
||||||
var result = m_filter.CreatePreset(presetName, out newPreset);
|
var result = m_filter.CreatePreset(presetName, out newPreset);
|
||||||
if (!result) OverlayManager.PopTip(result);
|
if (!result) OverlayManager.PopTip(result);
|
||||||
else optionUI.AddOptionMenuWhenPoping(new Opt_Presets(m_filter, newPreset));
|
else optionUI.AddOptionMenuWhenPoping(new Opt_Presets(m_filter, newPreset));
|
||||||
}, "为预设设置一个名称", string.Empty);
|
}, "为预设设置一个名称", string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Opt_Presets : ExpandMenu
|
public class Opt_Presets : ExpandMenu
|
||||||
{
|
{
|
||||||
private Filter m_filter;
|
private Filter m_filter;
|
||||||
private FilterPreset m_preset;
|
private FilterPreset m_preset;
|
||||||
private OptionUI_MenuItem m_ui;
|
private OptionUI_MenuItem m_ui;
|
||||||
private List<OptionMenu> m_menu;
|
private List<OptionMenu> m_menu;
|
||||||
|
|
||||||
public Opt_Presets(Filter filter, FilterPreset preset) : base(preset.Name, null)
|
public Opt_Presets(Filter filter, FilterPreset preset) : base(preset.Name, null)
|
||||||
{
|
{
|
||||||
m_filter = filter;
|
m_filter = filter;
|
||||||
m_preset = preset;
|
m_preset = preset;
|
||||||
|
|
||||||
m_menu = new List<OptionMenu>();
|
m_menu = new List<OptionMenu>();
|
||||||
m_menu.Add(new Opt_Delete(m_filter, m_preset));
|
m_menu.Add(new Opt_Delete(m_filter, m_preset));
|
||||||
foreach (var p in m_filter.Paramerters)
|
foreach (var p in m_filter.Paramerters)
|
||||||
{
|
{
|
||||||
m_menu.Add(new Opt_ParamEditor(m_filter, p, m_preset));
|
m_menu.Add(new Opt_ParamEditor(m_filter, p, m_preset));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnShow(OptionUI_MenuItem ui)
|
public override void OnShow(OptionUI_MenuItem ui)
|
||||||
{
|
{
|
||||||
EventInvoker.OnFilterPresetRemoved += EventInvoker_OnFilterPresetRemoved;
|
EventInvoker.OnFilterPresetRemoved += EventInvoker_OnFilterPresetRemoved;
|
||||||
m_ui = ui;
|
m_ui = ui;
|
||||||
base.OnShow(ui);
|
base.OnShow(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnHide()
|
public override void OnHide()
|
||||||
{
|
{
|
||||||
EventInvoker.OnFilterPresetRemoved -= EventInvoker_OnFilterPresetRemoved;
|
EventInvoker.OnFilterPresetRemoved -= EventInvoker_OnFilterPresetRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EventInvoker_OnFilterPresetRemoved(Filter filter, FilterPreset removedPreset)
|
private void EventInvoker_OnFilterPresetRemoved(Filter filter, FilterPreset removedPreset)
|
||||||
{
|
{
|
||||||
if (filter != m_filter || m_preset != removedPreset) return;
|
if (filter != m_filter || m_preset != removedPreset) return;
|
||||||
m_ui.OptionUI.RemoveItem(m_ui);
|
m_ui.OptionUI.RemoveItem(m_ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnFocus()
|
public override void OnFocus()
|
||||||
{
|
{
|
||||||
m_filter.ApplyPreset(m_preset);
|
m_filter.ApplyPreset(m_preset);
|
||||||
App.settings.Filter.EnableFilter(m_filter);
|
App.settings.Filter.EnableFilter(m_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<OptionMenu> GetOptionMenus()
|
protected override List<OptionMenu> GetOptionMenus()
|
||||||
{
|
{
|
||||||
return m_menu;
|
return m_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Opt_ParamEditor : ValueSetMenu
|
public class Opt_ParamEditor : ValueSetMenu
|
||||||
{
|
{
|
||||||
private Filter m_filter;
|
private Filter m_filter;
|
||||||
private FilterEffect.EditableParamerter m_param;
|
private FilterEffect.EditableParamerter m_param;
|
||||||
private FilterPreset m_preset;
|
private FilterPreset m_preset;
|
||||||
|
|
||||||
public override bool Visible => m_param.ValueType.IsEnum || m_param.ValueType == typeof(float);
|
public override bool Visible => m_param.ValueType.IsEnum || m_param.ValueType == typeof(float);
|
||||||
|
|
||||||
public Opt_ParamEditor(Filter filter, FilterEffect.EditableParamerter editParam, FilterPreset preset)
|
public Opt_ParamEditor(Filter filter, FilterEffect.EditableParamerter editParam, FilterPreset preset)
|
||||||
: base(editParam.Name)
|
: base(editParam.Name)
|
||||||
{
|
{
|
||||||
m_filter = filter;
|
m_filter = filter;
|
||||||
m_param = editParam;
|
m_param = editParam;
|
||||||
m_preset = preset;
|
m_preset = preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Type ValueType => m_param.ValueType;
|
public override Type ValueType => m_param.ValueType;
|
||||||
|
|
||||||
public override object ValueRaw => m_preset.GetParamValue(m_param.Name, ValueType) ?? m_param.Value;
|
public override object ValueRaw => m_preset.GetParamValue(m_param.Name, ValueType) ?? m_param.Value;
|
||||||
|
|
||||||
public override void OnValueChanged(object newValue)
|
public override void OnValueChanged(object newValue)
|
||||||
{
|
{
|
||||||
m_preset.SetParamValue(m_param.Name, ValueType, newValue);
|
m_preset.SetParamValue(m_param.Name, ValueType, newValue);
|
||||||
m_filter.SavePresets();
|
m_filter.SavePresets();
|
||||||
m_param.Apply(newValue);
|
m_param.Apply(newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override object Min => m_param.MinValue;
|
public override object Min => m_param.MinValue;
|
||||||
|
|
||||||
public override object Max => m_param.MaxValue;
|
public override object Max => m_param.MaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Opt_Delete : ExecuteMenu
|
public class Opt_Delete : ExecuteMenu
|
||||||
{
|
{
|
||||||
private Filter m_filter;
|
private Filter m_filter;
|
||||||
private FilterPreset m_preset;
|
private FilterPreset m_preset;
|
||||||
|
|
||||||
public Opt_Delete(Filter filter, FilterPreset preset) : base("删除预设", null)
|
public Opt_Delete(Filter filter, FilterPreset preset) : base("删除预设", null)
|
||||||
{
|
{
|
||||||
m_filter = filter;
|
m_filter = filter;
|
||||||
m_preset = preset;
|
m_preset = preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnExcute(OptionUI optionUI, ref bool cancelHide)
|
public override void OnExcute(OptionUI optionUI, ref bool cancelHide)
|
||||||
{
|
{
|
||||||
m_filter.RemovePreset(m_preset);
|
m_filter.RemovePreset(m_preset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
|
||||||
using static AxibugEmuOnline.Client.ScreenScaler;
|
using static AxibugEmuOnline.Client.ScreenScaler;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public static class GameObjectPool
|
public static class GameObjectPool
|
||||||
@ -40,8 +40,8 @@ public static class GameObjectPool
|
|||||||
public static void Release(GameObject instance)
|
public static void Release(GameObject instance)
|
||||||
{
|
{
|
||||||
GameObject src;
|
GameObject src;
|
||||||
Queue<GameObject> pool;
|
Queue<GameObject> pool;
|
||||||
s_instanceToSrc.TryGetValue(instance, out src);
|
s_instanceToSrc.TryGetValue(instance, out src);
|
||||||
if (src != null && s_poolMap.TryGetValue(src, out pool))
|
if (src != null && s_poolMap.TryGetValue(src, out pool))
|
||||||
{
|
{
|
||||||
pool.Enqueue(instance);
|
pool.Enqueue(instance);
|
||||||
|
@ -482,8 +482,8 @@ public class ItemPresent : GridLayoutGroup, IVirtualLayout
|
|||||||
}
|
}
|
||||||
else if (dataList is IEnumerable)
|
else if (dataList is IEnumerable)
|
||||||
{
|
{
|
||||||
var ienumrable = (IEnumerable)dataList;
|
var ienumrable = (IEnumerable)dataList;
|
||||||
List<object> temp = new List<object>();
|
List<object> temp = new List<object>();
|
||||||
foreach (var item in ienumrable)
|
foreach (var item in ienumrable)
|
||||||
{
|
{
|
||||||
temp.Add(item);
|
temp.Add(item);
|
||||||
|
@ -6,246 +6,246 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
|
|
||||||
public interface IVirtualLayout
|
public interface IVirtualLayout
|
||||||
{
|
{
|
||||||
Dictionary<GameObject, ScripteInterface> CacheItemScripts { get; }
|
Dictionary<GameObject, ScripteInterface> CacheItemScripts { get; }
|
||||||
List<object> DataList { get; }
|
List<object> DataList { get; }
|
||||||
object DependencyProperty { get; }
|
object DependencyProperty { get; }
|
||||||
RectTransform RectTransform { get; }
|
RectTransform RectTransform { get; }
|
||||||
RectTransform GetTemplate(object data);
|
RectTransform GetTemplate(object data);
|
||||||
Vector2 GetItemAnchorePos(int index);
|
Vector2 GetItemAnchorePos(int index);
|
||||||
RectTransform GetItemUIIfExist(int index);
|
RectTransform GetItemUIIfExist(int index);
|
||||||
|
|
||||||
void UpdateProxyVisualState();
|
void UpdateProxyVisualState();
|
||||||
void UpdateDependencyProperty(object dp);
|
void UpdateDependencyProperty(object dp);
|
||||||
void SetData(IEnumerable dataList);
|
void SetData(IEnumerable dataList);
|
||||||
void MoveToScrollViewCenter(ScrollRect scrollRect, int dataIndex);
|
void MoveToScrollViewCenter(ScrollRect scrollRect, int dataIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ItemProxy
|
public class ItemProxy
|
||||||
{
|
{
|
||||||
public bool IsDestroyed;
|
public bool IsDestroyed;
|
||||||
public bool Visible = true;
|
public bool Visible = true;
|
||||||
public int Index;
|
public int Index;
|
||||||
public bool IsInViewRect;
|
public bool IsInViewRect;
|
||||||
|
|
||||||
public Vector2 Pivot => _template.pivot;
|
public Vector2 Pivot => _template.pivot;
|
||||||
public Vector2 AnchoredPosition;
|
public Vector2 AnchoredPosition;
|
||||||
|
|
||||||
public float Width;
|
public float Width;
|
||||||
public float Height;
|
public float Height;
|
||||||
|
|
||||||
private IVirtualLayout _parent;
|
private IVirtualLayout _parent;
|
||||||
|
|
||||||
private RectTransform _template => _parent.GetTemplate(_parent.DataList[Index]);
|
private RectTransform _template => _parent.GetTemplate(_parent.DataList[Index]);
|
||||||
private RectTransform _runtimeInstance;
|
private RectTransform _runtimeInstance;
|
||||||
private LayoutGroup _layoutElement;
|
private LayoutGroup _layoutElement;
|
||||||
|
|
||||||
public RectTransform RuntimeItemUI => _runtimeInstance;
|
public RectTransform RuntimeItemUI => _runtimeInstance;
|
||||||
public bool firstShow { get; private set; } = true;
|
public bool firstShow { get; private set; } = true;
|
||||||
|
|
||||||
public float PreferredWidth
|
public float PreferredWidth
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_layoutElement == null) return 0;
|
if (_layoutElement == null) return 0;
|
||||||
|
|
||||||
return _layoutElement.preferredWidth;
|
return _layoutElement.preferredWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public float PreferredHeight
|
public float PreferredHeight
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_layoutElement == null) return 0;
|
if (_layoutElement == null) return 0;
|
||||||
|
|
||||||
return _layoutElement.preferredHeight;
|
return _layoutElement.preferredHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScripteInterface GetLuaObj()
|
public ScripteInterface GetLuaObj()
|
||||||
{
|
{
|
||||||
if (_runtimeInstance == null) return null;
|
if (_runtimeInstance == null) return null;
|
||||||
|
|
||||||
ScripteInterface lfi;
|
ScripteInterface lfi;
|
||||||
|
|
||||||
_parent.CacheItemScripts.TryGetValue(_runtimeInstance.gameObject, out lfi);
|
_parent.CacheItemScripts.TryGetValue(_runtimeInstance.gameObject, out lfi);
|
||||||
|
|
||||||
return lfi;
|
return lfi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemProxy(IVirtualLayout parent)
|
public ItemProxy(IVirtualLayout parent)
|
||||||
{
|
{
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_runtimeInstance != null)
|
if (_runtimeInstance != null)
|
||||||
{
|
{
|
||||||
if (Application.isPlaying)
|
if (Application.isPlaying)
|
||||||
{
|
{
|
||||||
GameObjectPool.Release(_runtimeInstance.gameObject);
|
GameObjectPool.Release(_runtimeInstance.gameObject);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GameObject.DestroyImmediate(_runtimeInstance.gameObject);
|
GameObject.DestroyImmediate(_runtimeInstance.gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool NeedShow
|
public bool NeedShow
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (IsInViewRect && _runtimeInstance == null) return true;
|
if (IsInViewRect && _runtimeInstance == null) return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_runtimeInstance != null && IsInViewRect && _runtimeInstance.anchoredPosition != AnchoredPosition)
|
if (_runtimeInstance != null && IsInViewRect && _runtimeInstance.anchoredPosition != AnchoredPosition)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public bool NeedHide => !IsInViewRect && _runtimeInstance != null;
|
public bool NeedHide => !IsInViewRect && _runtimeInstance != null;
|
||||||
|
|
||||||
public void UpdateView(bool force = false)
|
public void UpdateView(bool force = false)
|
||||||
{
|
{
|
||||||
if (IsInViewRect)
|
if (IsInViewRect)
|
||||||
{
|
{
|
||||||
if (_runtimeInstance == null)
|
if (_runtimeInstance == null)
|
||||||
{
|
{
|
||||||
_runtimeInstance = GetInstance();
|
_runtimeInstance = GetInstance();
|
||||||
_layoutElement = _runtimeInstance.GetComponent<LayoutGroup>();
|
_layoutElement = _runtimeInstance.GetComponent<LayoutGroup>();
|
||||||
UpdateViewData();
|
UpdateViewData();
|
||||||
}
|
}
|
||||||
else if (force)
|
else if (force)
|
||||||
{
|
{
|
||||||
UpdateViewData();
|
UpdateViewData();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateLayout();
|
UpdateLayout();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ReleaseInstance();
|
ReleaseInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateLayout()
|
public void UpdateLayout()
|
||||||
{
|
{
|
||||||
if (_runtimeInstance != null)
|
if (_runtimeInstance != null)
|
||||||
{
|
{
|
||||||
_runtimeInstance.gameObject.SetActive(true);
|
_runtimeInstance.gameObject.SetActive(true);
|
||||||
_runtimeInstance.anchorMax = Vector2.up;
|
_runtimeInstance.anchorMax = Vector2.up;
|
||||||
_runtimeInstance.anchorMin = Vector2.up;
|
_runtimeInstance.anchorMin = Vector2.up;
|
||||||
_runtimeInstance.anchoredPosition = AnchoredPosition;
|
_runtimeInstance.anchoredPosition = AnchoredPosition;
|
||||||
_runtimeInstance.sizeDelta = new Vector2(Width, Height);
|
_runtimeInstance.sizeDelta = new Vector2(Width, Height);
|
||||||
}
|
}
|
||||||
if (_layoutElement != null)
|
if (_layoutElement != null)
|
||||||
{
|
{
|
||||||
_layoutElement.CalculateLayoutInputHorizontal();
|
_layoutElement.CalculateLayoutInputHorizontal();
|
||||||
_layoutElement.CalculateLayoutInputVertical();
|
_layoutElement.CalculateLayoutInputVertical();
|
||||||
_layoutElement.SetLayoutHorizontal();
|
_layoutElement.SetLayoutHorizontal();
|
||||||
_layoutElement.SetLayoutVertical();
|
_layoutElement.SetLayoutVertical();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateViewData()
|
private void UpdateViewData()
|
||||||
{
|
{
|
||||||
if (Application.isPlaying)
|
if (Application.isPlaying)
|
||||||
{
|
{
|
||||||
if (!_parent.CacheItemScripts.ContainsKey(_runtimeInstance.gameObject))
|
if (!_parent.CacheItemScripts.ContainsKey(_runtimeInstance.gameObject))
|
||||||
{
|
{
|
||||||
var vItem = _runtimeInstance.gameObject.GetComponent<IVirtualItem>();
|
var vItem = _runtimeInstance.gameObject.GetComponent<IVirtualItem>();
|
||||||
ScripteInterface newSI = new ScripteInterface(vItem);
|
ScripteInterface newSI = new ScripteInterface(vItem);
|
||||||
_parent.CacheItemScripts[_runtimeInstance.gameObject] = newSI;
|
_parent.CacheItemScripts[_runtimeInstance.gameObject] = newSI;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScripteInterface si;
|
ScripteInterface si;
|
||||||
|
|
||||||
_parent.CacheItemScripts.TryGetValue(_runtimeInstance.gameObject, out si);
|
_parent.CacheItemScripts.TryGetValue(_runtimeInstance.gameObject, out si);
|
||||||
si.SetDataList(_parent.DataList[Index], Index);
|
si.SetDataList(_parent.DataList[Index], Index);
|
||||||
if (_parent.DependencyProperty != null)
|
if (_parent.DependencyProperty != null)
|
||||||
si.SetDependencyProperty(_parent.DependencyProperty);
|
si.SetDependencyProperty(_parent.DependencyProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateDP()
|
public void UpdateDP()
|
||||||
{
|
{
|
||||||
if (_runtimeInstance == null) return;
|
if (_runtimeInstance == null) return;
|
||||||
ScripteInterface luaInterface;
|
ScripteInterface luaInterface;
|
||||||
_parent.CacheItemScripts.TryGetValue(_runtimeInstance.gameObject, out luaInterface);
|
_parent.CacheItemScripts.TryGetValue(_runtimeInstance.gameObject, out luaInterface);
|
||||||
if (luaInterface == null) return;
|
if (luaInterface == null) return;
|
||||||
|
|
||||||
if (_parent.DependencyProperty != null)
|
if (_parent.DependencyProperty != null)
|
||||||
luaInterface.SetDependencyProperty(_parent.DependencyProperty);
|
luaInterface.SetDependencyProperty(_parent.DependencyProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private RectTransform GetInstance()
|
private RectTransform GetInstance()
|
||||||
{
|
{
|
||||||
var res = GameObjectPool.GetInstance(_template.gameObject, _parent.RectTransform).GetComponent<RectTransform>();
|
var res = GameObjectPool.GetInstance(_template.gameObject, _parent.RectTransform).GetComponent<RectTransform>();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReleaseInstance()
|
private void ReleaseInstance()
|
||||||
{
|
{
|
||||||
if (_runtimeInstance == null) return;
|
if (_runtimeInstance == null) return;
|
||||||
|
|
||||||
_layoutElement = null;
|
_layoutElement = null;
|
||||||
|
|
||||||
if (Application.isPlaying)
|
if (Application.isPlaying)
|
||||||
{
|
{
|
||||||
ScripteInterface si;
|
ScripteInterface si;
|
||||||
_parent.CacheItemScripts.TryGetValue(_runtimeInstance.gameObject, out si);
|
_parent.CacheItemScripts.TryGetValue(_runtimeInstance.gameObject, out si);
|
||||||
if (si != null) si.Release();
|
if (si != null) si.Release();
|
||||||
GameObjectPool.Release(_runtimeInstance.gameObject);
|
GameObjectPool.Release(_runtimeInstance.gameObject);
|
||||||
_runtimeInstance = null;
|
_runtimeInstance = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GameObject.DestroyImmediate(_runtimeInstance.gameObject);
|
GameObject.DestroyImmediate(_runtimeInstance.gameObject);
|
||||||
_runtimeInstance = null;
|
_runtimeInstance = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScripteInterface
|
public class ScripteInterface
|
||||||
{
|
{
|
||||||
private IVirtualItem _itemInstance;
|
private IVirtualItem _itemInstance;
|
||||||
public IVirtualItem ItemInstance => _itemInstance;
|
public IVirtualItem ItemInstance => _itemInstance;
|
||||||
|
|
||||||
public ScripteInterface(IVirtualItem lc)
|
public ScripteInterface(IVirtualItem lc)
|
||||||
{
|
{
|
||||||
_itemInstance = lc;
|
_itemInstance = lc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDataList(object dataItem, int index)
|
public void SetDataList(object dataItem, int index)
|
||||||
{
|
{
|
||||||
if (_itemInstance == null) return;
|
if (_itemInstance == null) return;
|
||||||
_itemInstance.Index = index;
|
_itemInstance.Index = index;
|
||||||
_itemInstance.SetData(dataItem);
|
_itemInstance.SetData(dataItem);
|
||||||
}
|
}
|
||||||
public void Release()
|
public void Release()
|
||||||
{
|
{
|
||||||
if (_itemInstance == null) return;
|
if (_itemInstance == null) return;
|
||||||
_itemInstance.Release();
|
_itemInstance.Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDependencyProperty(object dependencyProperty)
|
public void SetDependencyProperty(object dependencyProperty)
|
||||||
{
|
{
|
||||||
if (_itemInstance == null) return;
|
if (_itemInstance == null) return;
|
||||||
|
|
||||||
_itemInstance.SetDependencyProperty(dependencyProperty);
|
_itemInstance.SetDependencyProperty(dependencyProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IVirtualItem
|
public interface IVirtualItem
|
||||||
{
|
{
|
||||||
GameObject gameObject { get; }
|
GameObject gameObject { get; }
|
||||||
int Index { get; set; }
|
int Index { get; set; }
|
||||||
void SetData(object data);
|
void SetData(object data);
|
||||||
void SetDependencyProperty(object data);
|
void SetDependencyProperty(object data);
|
||||||
void Release();
|
void Release();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
@ -19,8 +19,8 @@ namespace AxibugEmuOnline.Client
|
|||||||
|
|
||||||
if (menuData is ValueSetMenu)
|
if (menuData is ValueSetMenu)
|
||||||
{
|
{
|
||||||
var valueMenu = (ValueSetMenu)menuData;
|
var valueMenu = (ValueSetMenu)menuData;
|
||||||
if (valueMenu.ValueType == typeof(float))
|
if (valueMenu.ValueType == typeof(float))
|
||||||
{
|
{
|
||||||
m_currentCom = com_floatEdit;
|
m_currentCom = com_floatEdit;
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
App.log.Warning($"尚未支持的数据类型:{valueMenu.ValueType}");
|
App.log.Warning($"尚未支持的数据类型:{valueMenu.ValueType}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
m_msgText.text = msg;
|
m_msgText.text = msg;
|
||||||
Canvas.ForceUpdateCanvases();
|
Canvas.ForceUpdateCanvases();
|
||||||
|
|
||||||
var targetPos = new Vector2(-RectTransform.rect.width - 20 , RectTransform.anchoredPosition.y);
|
var targetPos = new Vector2(-RectTransform.rect.width - 20, RectTransform.anchoredPosition.y);
|
||||||
DOTween.To(
|
DOTween.To(
|
||||||
() => RectTransform.anchoredPosition,
|
() => RectTransform.anchoredPosition,
|
||||||
(value) => RectTransform.anchoredPosition = value,
|
(value) => RectTransform.anchoredPosition = value,
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugEmuOnline.Client.Event;
|
using AxibugEmuOnline.Client.Event;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using AxibugEmuOnline.Client.UI;
|
using AxibugEmuOnline.Client.UI;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
@ -182,12 +182,12 @@ namespace AxibugEmuOnline.Client
|
|||||||
}
|
}
|
||||||
|
|
||||||
private MenuItem Clone(MenuItem template, Transform parent)
|
private MenuItem Clone(MenuItem template, Transform parent)
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
|
||||||
//========================套娃宏========================
|
//========================套娃宏========================
|
||||||
#if UNITY_2019_1_OR_NEWER //新版Unity,因UNITY2018.2用不了这玩意儿,编辑器也罢
|
#if UNITY_2019_1_OR_NEWER //新版Unity,因UNITY2018.2用不了这玩意儿,编辑器也罢
|
||||||
|
|
||||||
if (Application.isPlaying)
|
if (Application.isPlaying)
|
||||||
{
|
{
|
||||||
var item = GameObject.Instantiate(template.gameObject, parent).GetComponent<MenuItem>();
|
var item = GameObject.Instantiate(template.gameObject, parent).GetComponent<MenuItem>();
|
||||||
@ -199,19 +199,19 @@ namespace AxibugEmuOnline.Client
|
|||||||
var clone = UnityEditor.PrefabUtility.InstantiatePrefab(template.gameObject, parent) as GameObject;
|
var clone = UnityEditor.PrefabUtility.InstantiatePrefab(template.gameObject, parent) as GameObject;
|
||||||
clone.transform.localPosition = Vector3.zero;
|
clone.transform.localPosition = Vector3.zero;
|
||||||
return clone.GetComponent<MenuItem>();
|
return clone.GetComponent<MenuItem>();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
var item = GameObject.Instantiate(template.gameObject, parent).GetComponent<MenuItem>();
|
var item = GameObject.Instantiate(template.gameObject, parent).GetComponent<MenuItem>();
|
||||||
item.transform.localPosition = Vector3.zero;
|
item.transform.localPosition = Vector3.zero;
|
||||||
return item;
|
return item;
|
||||||
#endif
|
#endif
|
||||||
//========================套娃宏 End========================
|
//========================套娃宏 End========================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
return GameObject.Instantiate(SubMenuItemTemplate.gameObject, parent).GetComponent<MenuItem>();
|
return GameObject.Instantiate(SubMenuItemTemplate.gameObject, parent).GetComponent<MenuItem>();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@ -9,8 +9,8 @@ namespace AxibugEmuOnline.Client
|
|||||||
private static Dictionary<Graphic, Material> _caches = new Dictionary<Graphic, Material>();
|
private static Dictionary<Graphic, Material> _caches = new Dictionary<Graphic, Material>();
|
||||||
public static Material GetMaterial(this Graphic graphic)
|
public static Material GetMaterial(this Graphic graphic)
|
||||||
{
|
{
|
||||||
Material material;
|
Material material;
|
||||||
if (_caches.TryGetValue(graphic, out material))
|
if (_caches.TryGetValue(graphic, out material))
|
||||||
{
|
{
|
||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -13,7 +12,6 @@ namespace AxibugEmuOnline.Client
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
protected CanvasGroup RomGroupRoot;
|
protected CanvasGroup RomGroupRoot;
|
||||||
|
|
||||||
|
|
||||||
private TweenerCore<float, float, FloatOptions> m_showTween;
|
private TweenerCore<float, float, FloatOptions> m_showTween;
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugEmuOnline.Client.Event;
|
using AxibugEmuOnline.Client.Event;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using VirtualNes.Core;
|
|
||||||
|
|
||||||
public class ControllerInfo : MonoBehaviour
|
public class ControllerInfo : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,8 @@ using AxibugEmuOnline.Client.ClientCore;
|
|||||||
using AxibugEmuOnline.Client.Event;
|
using AxibugEmuOnline.Client.Event;
|
||||||
using AxibugEmuOnline.Client.Manager;
|
using AxibugEmuOnline.Client.Manager;
|
||||||
using AxibugProtobuf;
|
using AxibugProtobuf;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VirtualNes.Core;
|
|
||||||
|
|
||||||
public class ControllerInfoPanel : MonoBehaviour
|
public class ControllerInfoPanel : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user