public void Exit <T>() where T : BaseCtrl { var findCtrl = FindCtrl <T>(); if (findCtrl == currMainCtrl) { //先打开上一组 ctrl 之后也改成异步回调之后再关闭 currMainCtrl = null; var nextIndex = ctrlCacheList.Count - 2; findCtrl.Inactive(); findCtrl.Exit(); ctrlCacheList.Remove(findCtrl); if (nextIndex >= 0) { BaseCtrl currCtrl = ctrlCacheList[nextIndex]; currCtrl.Active(); currMainCtrl = currCtrl; } } else { Logx.LogError("findCtrl == ctrl : " + typeof(T) + " != " + currMainCtrl?.GetType()); return; } }
public void OnOneResLoadFinish(string currPath, UnityEngine.Object asset) { if (currNeedLoadSet.Contains(currPath)) { currNeedLoadSet.Remove(currPath); } else { Logx.LogError("the currPath is not correct : " + currPath); } }
public void ReturnObj(string path, UnityEngine.Object obj) { ObjectPool pool = null; if (objectPoolDic.ContainsKey(path)) { pool = objectPoolDic[path]; pool.ReturnObject(obj); } else { Logx.LogWarning("ObjectPoolGroup : GetObject : the path is not found : " + path); } }
public void Connect(string ip, int port) { try { Logx.Log("net", "start connect ..."); IPAddress mIp = IPAddress.Parse(ip); IPEndPoint ip_end_point = new IPEndPoint(mIp, port); netSocket.BeginConnect(ip_end_point, OnConnectCallback, netSocket); } catch (Exception e) { Console.WriteLine(e); //ChangeToCloseState(); } }
public void ReturnObject <T>(string path, T obj) where T : UnityEngine.Object { var type = typeof(T); ObjectPoolGroup group = null; if (objectPoolGroupDic.ContainsKey(type)) { group = objectPoolGroupDic[type]; group.ReturnObj(path, obj); } else { Logx.LogWarning("the type is not found : " + type.ToString()); } }
internal void ReturnObject(UnityEngine.Object obj) { var isGo = obj is GameObject; var insId = obj.GetInstanceID(); if (isGo) { if (objectDic.ContainsKey(insId)) { var findObj = objectDic[insId]; findObj.Return(); } else { Logx.LogWarning("the insId is not found : " + insId); } } }
public override void OnPrepareFinish() { var assetBundleCache = AssetBundleManager.Instance.GetCacheByPath(abPath); if (null == assetBundleCache) { Logx.LogError("AssetLoader", "the assetBundleCache is null : " + abPath); return; } if (null == assetBundleCache.assetBundle) { Logx.LogError("AssetLoader", "the assetBundleCache.assetBundle is null : " + abPath); return; } var ab = assetBundleCache.assetBundle; assetRequest = ab.LoadAssetAsync(path); }
//No parameters static public void Broadcast(int eventType) { OnBroadcasting(eventType); Delegate d; if (eventTable.TryGetValue(eventType, out d)) { Callback callback = d as Callback; if (callback != null) { callback(); } else { //throw CreateBroadcastSignatureException(eventType); Logx.LogWarning("the event hasnt listener : " + eventType); } } }
void OnConnectCallback(IAsyncResult ar) { var s = (Socket)ar.AsyncState; Logx.Log("net", "OnConnectCallback : on connect : " + s.Connected); if (s.Connected) { netState = NetState.Connect; s.EndConnect(ar); s.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(OnReceiveCallback), s); } else { Logx.LogWarning("OnConnectCallback : the socket connect fail"); } //heartBeatService.Start(); bool isSuccessConnect = netSocket.Connected; connectAction?.Invoke(isSuccessConnect); }
public T GetById <T>(int id) where T : Table.BaseTable { var type = typeof(T); if (typeToDicConfigDic.ContainsKey(type)) { var dataDic = typeToDicConfigDic[type]; if (dataDic.ContainsKey(id)) { var data = dataDic[id]; return(data as T); } else { Logx.LogError("Table", "the id is not found : " + id); } } else { Logx.LogError("Table", "the type is not found : " + type); } return(null); }
public void OnConnectToLoginServerFinish(bool isSuccess) { Logx.Log("net", "NetworkManager : OnConnectToLoginServerFinish : " + isSuccess); }