Exemplo n.º 1
0
        /// <summary>
        /// 开始请求
        /// </summary>
        /// <param name="strURL"></param>
        /// <param name="handleOnResponse"></param>
        /// <param name="postForm"></param>
        /// <param name="objSessionRequest"></param>
        /// <returns></returns>
        public bool StartGet(string strURL, HandleHTTPOnResponse handleOnResponse, WWWForm postForm = null, System.Object objSessionRequest = null)
        {
            if (m_bIsRequesting == true)
            {
                return(false);
            }
            try
            {
                m_WWWWorker = new WWW(strURL);
            }
            catch (System.Exception ex)
            {
                BTDebug.ExceptionEx(ex);
            }

            if (m_WWWWorker == null)
            {
                return(false);
            }
            m_HandleOnResponse  = handleOnResponse;
            m_ObjSessionRequest = objSessionRequest;
            m_bIsRequesting     = true;

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="handleOnLoadComplete"></param>
        /// <returns></returns>
        public IEnumerator AsynLoad(Action <Object> handleOnLoadComplete)
        {
            while (true)
            {
                if (m_GameObject != null)
                {
                    if (handleOnLoadComplete != null)
                    {
                        handleOnLoadComplete(m_GameObject);
                    }
                    yield break;
                }

                try
                {
                    m_GameObject = Resources.LoadAssetAtPath(m_strPath, typeof(GameObject)) as GameObject;
                    if (m_GameObject == null)
                    {
                        BTDebug.Warning(string.Format("Editor Load {0} Failed, Record Path:{1}", m_strName, m_strPath), "RESOURCE");
                    }
                }
                catch (System.Exception ex)
                {
                    BTDebug.ExceptionEx(ex);
                }
                yield return(null);

                if (handleOnLoadComplete != null)
                {
                    handleOnLoadComplete(m_GameObject);
                }

                yield break;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 在缓冲区接收到一个完整消息
        /// </summary>
        private void OnReadBuffComplete()
        {
            if (m_bIsReadingHead == true)
            {
                Int32 nSize = BitConverter.ToInt32(m_ReceiveByteBuff, 0);
                nSize = IPAddress.NetworkToHostOrder(nSize);

                m_nReceiveBuffReadLength = nSize;
                m_bIsReadingHead         = false;
            }
            else
            {
                bool bPackReceivedMsg = false;
                if (m_nReceiveBuffPos > 0)
                {
                    Int32  nSize         = m_nReceiveBuffPos + 1;
                    Byte[] byteDataArray = new Byte[nSize];
                    for (Int32 i = 0; i < nSize; ++i)
                    {
                        byteDataArray[i] = m_ReceiveByteBuff[i];
                    }
                    bPackReceivedMsg = m_QueMsgReceive.Push(byteDataArray);
                }
                if (bPackReceivedMsg == false)
                {
                    BTDebug.Error("Push BTMessage Failed, Message Package Lose");
                }

                m_nReceiveBuffReadLength = CBTByteNetStream.cnBTMsgHeadSize;
                m_bIsReadingHead         = true;
            }
            m_nReceiveBuffPos = 0;
        }
Exemplo n.º 4
0
 /// <summary>
 /// 断开连接
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public Int32 Disconnect(TNetState state)
 {
     BTDebug.Log("Disconnect For:" + state.ToString(), "NET");
     m_State = state;
     if (m_Socket == null)
     {
         return(0);
     }
     try
     {
         if (m_Socket.Connected == true)
         {
             m_Socket.Shutdown(SocketShutdown.Both);
             if (m_HandleOnDisConnected != null)
             {
                 m_HandleOnDisConnected(0);
             }
         }
     }
     catch (System.Exception ex)
     {
         BTDebug.Exception("ShutDown Socket Error:" + ex.Message);
         if (m_HandleOnDisConnected != null)
         {
             m_HandleOnDisConnected(-1);
         }
     }
     m_Socket.Close();
     m_Socket = null;
     return(0);
 }
Exemplo n.º 5
0
        // 从xml数据创建动作列表
        private List <CFSMAction> CreateActionListFromXML(CFSMXMLActionArray actionxmlList)
        {
            if (actionxmlList == null)
            {
                return(null);
            }
            List <CFSMAction> actionList = new List <CFSMAction>();
            Int32             nSize      = actionxmlList.m_ActionList == null ? 0 : actionxmlList.m_ActionList.Count;

            for (Int32 i = 0; i < nSize; ++i)
            {
                CFSMXMLAction actionxml = actionxmlList.m_ActionList[i];
                if (actionxml == null)
                {
                    continue;
                }
                CFSMAction newAction = new CFSMAction();
                if (newAction.CreateFromXML(actionxml) == false)
                {
                    BTDebug.Warning("<BTFSM> Create FSM Action Failed");
                    continue;
                }
                actionList.Add(newAction);
            }
            return(actionList);
        }
Exemplo n.º 6
0
        // 更新当前状态
        protected virtual void UpdateCurrentState()
        {
            if (m_CurrentState == null)
            {
                return;
            }
            // 获取下一个状态, 如果没有则循环执行当前状态
            UInt32 uNextStateId = m_CurrentState.GetFSMTransState(this);

            if (uNextStateId == CFSMState.cuInvalieStateId)
            {
                if (m_CurrentState.Process(this, null) == false)
                {
                    BTDebug.Warning(string.Format("<BTFSM> State:{0} Process Failed", m_CurrentState.GetStateName()));
                }
                return;
            }
            // 切换到下一状态
            bool bChangeRet = ChangeToState(uNextStateId, null);

            if (bChangeRet == false)
            {
                BTDebug.Warning(string.Format("<BTFSM> FSM Trans From:{0} To:{1} Failed", m_CurrentState.GetStateID(), uNextStateId));
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 帧更新
        /// </summary>
        public void Update()
        {
            while (m_ListenedEvent.IsEmpty() == false)
            {
                System.Object objInfo = null;
                if (m_ListenedEvent.Pop(ref objInfo) == false || objInfo == null)
                {
                    continue;
                }
                CEventInfo info = objInfo as CEventInfo;
                if (info == null)
                {
                    continue;
                }
                UInt32        uEventId = info.GetEventId();
                System.Object objParam = info.GetEventParam();

                m_EventInfoPool.GiveBackObject(info);

                CHandleInfo handleInfo = null;
                if (m_EventActionList.QuickFind(uEventId, ref handleInfo) == false || handleInfo == null)
                {
                    continue;
                }
                bool bTriggerRet = handleInfo.TriggerHandle(objParam);
                if (bTriggerRet == false)
                {
                    BTDebug.Warning(string.Format("Trigger Event:{0} With Param:{2} Failed", uEventId, objParam), "ACTION");
                }
            }
        }
Exemplo n.º 8
0
 void Start()
 {
     luaenv = new LuaEnv();
     luaenv.AddLoader((ref string filename) =>
     {
         string path = Application.dataPath + "/../../XClientLua/lua/" + filename + ".lua";
         if (File.Exists(path))
         {
             return(File.ReadAllBytes(path));
         }
         else
         {
             path = Application.dataPath + "/../../XCommon/lua/" + filename + ".lua";
             if (File.Exists(path))
             {
                 return(File.ReadAllBytes(path));
             }
             else
             {
                 return(null);
             }
         }
     });
     luaenv.DoString("require('main/startup')");
     BTDebug.Init(luaenv);
 }
Exemplo n.º 9
0
 // 更新
 public void OnUpdateConnect()
 {
     while (m_QueMsgReceive.IsEmpty() == false)
     {
         System.Object refObj = null;
         if (m_QueMsgReceive.Pop(ref refObj) == false)
         {
             break;
         }
         if (refObj == null)
         {
             continue;
         }
         Byte[] receByteArray = refObj as Byte[];
         if (receByteArray == null)
         {
             BTDebug.Warning("Receive Data Not Packed as Byte Array", "NET");
             continue;
         }
         if (m_HandleOnReceiveMsg != null)
         {
             m_HandleOnReceiveMsg(receByteArray);
         }
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// 开始加载游戏启动数据
 /// </summary>
 public void StartLoading()
 {
     GameDataManager.Instance.StartLoadData(m_preLoadDataTypeList, OnLoadComplete, (info) =>
     {
         BTDebug.Exception("Load GameData Error");
     });
 }
Exemplo n.º 11
0
 // 初始化Debug
 void InitGameDebug()
 {
     BTDebug.RegisterHandle(UnityEngine.Debug.Log, BTDebug.TDebugLevel.enLog);
     BTDebug.RegisterHandle(UnityEngine.Debug.LogWarning, BTDebug.TDebugLevel.enWarning);
     BTDebug.RegisterHandle(UnityEngine.Debug.LogError, BTDebug.TDebugLevel.enError);
     BTDebug.RegisterHandle(UnityEngine.Debug.LogError, BTDebug.TDebugLevel.enException);
 }
Exemplo n.º 12
0
 /// <summary>
 /// CallBack After Socket Connectd
 /// </summary>
 /// <param name="ar"></param>
 private void ConnectCallback(IAsyncResult ar)
 {
     try
     {
         ar.AsyncWaitHandle.Close();
         if (m_Socket != null)
         {
             m_Socket.EndConnect(ar);
             m_Socket.Blocking       = false;               // 非阻断
             m_Socket.ReceiveTimeout = 3000;
             m_Socket.SendTimeout    = 3000;
         }
         m_State = TNetState.State_Connected;
         if (m_HandleOnConnected != null)
         {
             m_HandleOnConnected(0);
         }
     }
     catch (Exception ex)
     {
         if (m_HandleOnConnected != null)
         {
             m_HandleOnConnected(-1);
         }
         BTDebug.Exception("Socket Connect CallBack Exception:" + ex.Message);
         Disconnect(TNetState.State_ConnectFailed);
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// 从配置创建状态机
        /// </summary>
        /// <param name="fsmXMLEntity"></param>
        /// <returns></returns>
        public bool CreateFromFSMXML(CFSMXMLEntity fsmXMLEntity)
        {
            if (fsmXMLEntity == null)
            {
                return(false);
            }
            m_uEnteranceStateId = fsmXMLEntity.m_uEntranceStateId;
            m_uAnyStateId       = fsmXMLEntity.m_uAnyStateId;
            Int32 nStateSize = fsmXMLEntity.m_FSMStateList == null ? 0 : fsmXMLEntity.m_FSMStateList.Count;

            for (Int32 i = 0; i < nStateSize; ++i)
            {
                CFSMXMLState xmlState = fsmXMLEntity.m_FSMStateList[i];
                if (xmlState == null)
                {
                    continue;
                }
                CFSMExecutableState fsmState = new CFSMExecutableState();
                if (fsmState.CreateFromXML(xmlState) == false)
                {
                    BTDebug.Warning("<BTFSM> Create FSM State Failed");
                    continue;
                }
                AddState(fsmState);
            }
            return(true);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 设置FSM调试开关
        /// 仅对BTDEBUG下的BTCore有效
        /// </summary>
        /// <param name="bOpen"></param>
        public void SetOpenFSMDebug(bool bOpen)
        {
#if BTDEBUG
            m_bOpenDebug = bOpen;
#else
            BTDebug.Warning("<BTFSM> BTCore On Release Mode Not Support FSM Debug");
#endif
        }
Exemplo n.º 15
0
        // 加载 由GameDataManager管理
        private static bool Load(Action handleOnLoadComplete, Action <string> handleOnLoadError)
        {
            Action <string> tmpActionOnError = (strInfo) =>
            {
                if (handleOnLoadError != null)
                {
                    handleOnLoadError(strInfo);
                }
            };

            if (m_DataSingleton != null)             // 重复加载
            {
                string strErrorInfo = string.Format("Duplicate Load:{0}", typeof(U));
                BTDebug.Warning(strErrorInfo, "DATA");
                tmpActionOnError(strErrorInfo);
                return(false);
            }
            m_DataSingleton = new GameData <T>();
            string strDataFileKey = GetDataFileKey();

            if (string.IsNullOrEmpty(strDataFileKey) == true)
            {
                string strErrorInfo = string.Format("GameData:{0} Has No DataFileKey", typeof(U).ToString());
                BTDebug.Exception(strErrorInfo, "DATA");
                tmpActionOnError(strErrorInfo);
                return(false);
            }

            if (GameDataManager.Instance.AsynLoadGameDataFile(strDataFileKey, (errorInfo, dataArray) =>
            {
                if (string.IsNullOrEmpty(errorInfo) == false)
                {
                    BTDebug.Exception(string.Format("GameData:{0} Load File Error:{1}", typeof(U), errorInfo), "DATA");
                    tmpActionOnError(errorInfo);
                    return;
                }
                if (m_DataSingleton.ReadFromXML(PackageSetting.cTextFileEncoding.GetString(dataArray)) == false)
                {
                    string info = string.Format("GameData:{0} Parse Failed", typeof(U).ToString());
                    BTDebug.Exception(info, "DATA");
                    tmpActionOnError(errorInfo);
                    return;
                }
                if (handleOnLoadComplete != null)
                {
                    handleOnLoadComplete();
                }
            }
                                                              ) == false)
            {
                string strInfo = string.Format("GameData:{0} Load File Failed", typeof(U).ToString());
                BTDebug.Exception(strInfo, "DATA");
                tmpActionOnError(strInfo);
                return(false);
            }

            return(true);
        }
Exemplo n.º 16
0
    static void BTStartDebug()
    {
        long id = GetId(Selection.activeGameObject);

        if (id < 0)
        {
            return;
        }
        BTDebug.SyncStartDebug(id);
    }
Exemplo n.º 17
0
    static void BTPause()
    {
        long id = GetId(Selection.activeGameObject);

        if (id < 0)
        {
            return;
        }
        BTDebug.SyncPause(id);
    }
Exemplo n.º 18
0
    /// <summary>
    /// 加载数据
    /// </summary>
    /// <param name="dataType"></param>
    /// <param name="handleOnLoadComplete"></param>
    /// <param name="handleOnLoadError"></param>
    /// <param name="bClearIfLoaded"></param>
    /// <returns></returns>
    public bool StartLoadData(Type dataType, Action handleOnLoadComplete, Action <string> handleOnLoadError, bool bClearIfLoaded = false)
    {
        if (dataType == null)
        {
            return(false);
        }
        bool bRet         = false;
        Type gameDataType = GetGameDataCollectionType(dataType.BaseType);

        if (gameDataType == null)
        {
            BTDebug.Warning(string.Format("Load DataType:{0} Not AssignableFrom GameData", dataType.Name), "DATA");
            return(false);
        }

        if (mLoadedGameDataList.Contains(dataType))
        {
            if (bClearIfLoaded == true)
            {
                ClearData(dataType);
            }
            else
            {
                BTDebug.Warning(string.Format("Dup Load DataType:{0} ", dataType.Name), "DATA");
                return(false);
            }
        }

        System.Reflection.MethodInfo methodInfo = gameDataType.GetMethod(
            cStrGameDataLoadMethodName,
            System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);

        if (methodInfo == null)
        {
            BTDebug.Warning(string.Format("DataType:{0} No {1} Method", dataType.Name, cStrGameDataLoadMethodName), "DATA");
            return(false);
        }
        try
        {
            Object[] paramArray = { handleOnLoadComplete, handleOnLoadError };
            bRet = (bool)methodInfo.Invoke(null, paramArray);
        }
        catch (System.Exception ex)
        {
            BTDebug.ExceptionEx(ex);
            bRet = false;
        }
        if (bRet == true)
        {
            mLoadedGameDataList.Add(dataType);
        }
        return(bRet);
    }
Exemplo n.º 19
0
        public bool Start()
        {
            BTDebug.Log("Game Client Start", "CLIENT");
            if (m_GameFSM == null)
            {
                return(false);
            }
#if UNITY_EDITOR
            m_GameFSM.SetOpenFSMDebug(true);
#endif
            UInt32 uStateIDUpdate = (UInt32)TGameStateType.enInstall;
            bool   bFSMStartRet   = m_GameFSM.Start(uStateIDUpdate);
            return(bFSMStartRet);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 执行FSM动作
        /// </summary>
        /// <param name="strActionName"></param>
        /// <param name="objParamArray"></param>
        /// <param name="rOutResultValue"></param>
        /// <returns></returns>
        public bool InvokeFSMAction(string strActionName, System.Object[] objParamArray, out System.Object rOutResultValue)
        {
            rOutResultValue = default(System.Object);
            if (m_Reflector == null)
            {
                return(false);
            }
            bool bRet = m_Reflector.InvokeMethod(strActionName, m_BindEntity, objParamArray, out rOutResultValue);

#if BTDEBUG
            BTDebug.Log(string.Format("<BTFSM> FSM Invoke Action:{0} {1}", strActionName, bRet ? "Success" : "Failed"));
#endif
            return(bRet);
        }
Exemplo n.º 21
0
        /// <summary>
        /// FSM事件
        /// </summary>
        /// <param name="fsmEvent"></param>
        public virtual void OnFSMEvent(CFSMEvent fsmEvent)
        {
#if BTDEBUG
            if (m_bOpenDebug == true && fsmEvent != null)
            {
                BTDebug.Log(string.Format("<BTFSM> FSM Receive Event:{0}", fsmEvent.GetEventId()));
            }
#endif
            if (m_ListenedEventList == null)
            {
                return;
            }
            m_ListenedEventList.Add(fsmEvent);
        }
Exemplo n.º 22
0
        protected virtual void OnReceiveMessage(Int32 nReadByteSize)
        {
            Byte[] msgByteArray = new Byte[nReadByteSize];
            for (Int32 i = 0; i < nReadByteSize; ++i)
            {
                msgByteArray[i] = m_ReceiveByteBuff[i];
            }

            if (m_QueMsgReceive.Push(msgByteArray) == false)
            {
                BTDebug.Error("Receive Msg Push Queue Error, Message Lose!", "NET");
            }

            m_nReceiveBuffPos = 0;
        }
Exemplo n.º 23
0
 protected override void OnInit()
 {
     if (Application.platform == RuntimePlatform.Android ||
         Application.platform == RuntimePlatform.WindowsPlayer ||
         Application.platform == RuntimePlatform.IPhonePlayer)
     {
         IsAbRes = true;
         IsAbLua = true;
         IsAbCfg = true;
     }
     XLog.Instance.Init();
     ABMgr.Instance.Init();
     XLuaMgr.Instance.Init();
     BTDebug.Init(XLuaMgr.Instance.GetLuaEnv());
 }
Exemplo n.º 24
0
        /// <summary>
        /// 触发事件
        /// </summary>
        /// <param name="uEventId"></param>
        /// <param name="objParam"></param>
        /// <returns></returns>
        public bool TriggerAction(UInt32 uEventId, System.Object objParam)
        {
            CEventInfo eventInfo = m_EventInfoPool.RentObject() as CEventInfo;

            if (eventInfo == null)
            {
                BTDebug.Warning(string.Format("Action {0} Trigger Failed, Event Info NULL", uEventId), "ACTION");
                return(false);
            }
            eventInfo.Set(uEventId, objParam);
            if (m_ListenedEvent.Push(eventInfo) == false)
            {
                BTDebug.Warning(string.Format("Action {0} Trigger Failed, Event Info Push Failed", uEventId), "ACTION");
                return(false);
            }
            return(true);
        }
Exemplo n.º 25
0
 /// <summary>
 /// 从流中读取数据
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="memStream"></param>
 /// <param name="rOutT"></param>
 /// <returns></returns>
 public static bool ReadPBFromStream <T>(MemoryStream memStream, ref T rOutT) where T : class
 {
     if (memStream == null)
     {
         return(false);
     }
     try
     {
         rOutT = ProtoBuf.Serializer.Deserialize <T>(memStream);
     }
     catch (System.Exception ex)
     {
         BTDebug.ExceptionEx(ex);
         rOutT = null;
     }
     return(true);
 }
Exemplo n.º 26
0
        /// <summary>
        /// 切换到一个状态
        /// </summary>
        /// <param name="uNextState"></param>
        /// <param name="fsmEvent"></param>
        /// <returns></returns>
        public bool ChangeToState(UInt32 uNextState, CFSMEvent fsmEvent)
        {
            CFSMState nextFSMState = GetState(uNextState);

            if (nextFSMState == null)
            {
                BTDebug.Warning(string.Format("Found NO State With ID:{0}, Change State Failed", uNextState), "FSM");
                return(false);
            }

            if (m_CurrentState != null)
            {
                if (m_CurrentState.GetStateID() == uNextState)
                {
                    return(true);
                }

                if (m_CurrentState.OnExit(this, fsmEvent) == false)
                {
                    BTDebug.Warning(string.Format("State:{0} Exit Failed", m_CurrentState.GetStateName()), "FSM");
                }
            }

#if BTDEBUG
            if (m_bOpenDebug)
            {
                string strLog = string.Format("FSM Trans From:{0} To:{1}",
                                              m_CurrentState == null ? "NULL" : m_CurrentState.GetStateName(),
                                              nextFSMState.GetStateName());

                BTDebug.Log(strLog, "BTFSM");
            }
#endif

            m_CurrentState = nextFSMState;

            if (nextFSMState.OnEnter(this, fsmEvent) == false)
            {
                BTDebug.Warning(string.Format("State:{0} Enter Failed", nextFSMState.GetStateName()), "FSM");
            }

            return(true);
        }
Exemplo n.º 27
0
    /// <summary>
    /// 清除数据
    /// </summary>
    /// <param name="dataType"></param>
    /// <returns></returns>
    public bool ClearData(Type dataType)
    {
        if (mLoadedGameDataList == null)
        {
            return(false);
        }
        if (mLoadedGameDataList.Contains(dataType) == false)
        {
            return(false);
        }
        Type gameDataType = GetGameDataCollectionType(dataType.BaseType);

        if (gameDataType == null)
        {
            return(false);
        }
        System.Reflection.MethodInfo methodInfo = gameDataType.GetMethod(
            cStrGameDataClearMethodName,
            System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);

        if (methodInfo == null)
        {
            BTDebug.Warning(string.Format("DataType:{0} No {1} Method", dataType.Name, cStrGameDataClearMethodName), "DATA");
            return(false);
        }

        bool bRet = false;

        try
        {
            bRet = (bool)methodInfo.Invoke(null, null);
        }
        catch (System.Exception ex)
        {
            BTDebug.ExceptionEx(ex);
            bRet = false;
        }
        if (bRet == true)
        {
            mLoadedGameDataList.Remove(dataType);
        }
        return(bRet);
    }
Exemplo n.º 28
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(20, 20, 100, 40), "Test"))
        {
            //InstanceCacheManager.Instance.GetInstance("bl_00", (name, obj) =>
            //    {
            //        BTDebug.Warning("Load:" + name + " Type:" + obj.GetType());
            //    });
            string strDump = NS_GAME.DATA.Data_ConfigTree.DumpData();
            BTDebug.Log(strDump);
            strDump = NS_GAME.DATA.Data_EditorTextList.DumpData();
            BTDebug.Log(strDump);
            strDump = NS_GAME.DATA.Data_EditorObjectList.DumpData();
            BTDebug.Log(strDump);

            InstanceCacheManager.Instance.GetInstance("bl_00", (name, instance) =>
            {
            });
        }
    }
Exemplo n.º 29
0
        // 更新公共状态
        protected virtual void UpdateAnyState()
        {
            if (m_AnyState == null)
            {
                return;
            }
            // 获取下一个状态, 如果没有则循环执行当前状态
            UInt32 uNextStateId = m_AnyState.GetFSMTransState(this);

            if (uNextStateId != CFSMState.cuInvalieStateId)
            {
                ChangeToState(uNextStateId, null);
                return;
            }
            if (m_AnyState.Process(this, null) == false)
            {
                BTDebug.Warning(string.Format("<BTFSM> State:{0} Process Failed", m_CurrentState.GetStateName()));
            }
            return;
        }
Exemplo n.º 30
0
    /// <summary>
    /// 释放GameObject实体
    /// </summary>
    /// <param name="go"></param>
    /// <returns></returns>
    public bool ReleaseInstance(Object go)
    {
        if (go == null)
        {
            return(false);
        }
        Int32  guid    = go.GetInstanceID();
        string strName = string.Empty;

        if (m_InstanceMap.TryGetValue(guid, out strName) == false)
        {
            BTDebug.Warning(string.Format("Release Game Object:{0} No Record in Map", go.name), "RESOURCE");
            return(false);
        }

        m_InstanceMap.Remove(guid);
        m_AssetsLoader.ReleaseAsset(strName);
        GameObject.Destroy(go);
        return(true);
    }