示例#1
0
 protected void ReceiveMessage()
 {
     try
     {
         while (mStartThread)
         {
             if (mSocket.Available != 0)
             {
                 int receiveNumber = 0;
                 receiveNumber = mSocket.Receive(mRecbuffer, 0, mReadMaxLen, SocketFlags.None);
                 if (receiveNumber > 0)
                 {
                     Processingdata(receiveNumber, mRecbuffer);
                 }
             }
             Thread.Sleep(1);
         }
     }
     catch (Exception e)
     {
         DLog.LogError(mNetTag + ":ReceiveMessage->" + e.ToString());
         CloseSRThread();
         AddMainThreadMsgReCall(GetMsgReCallData(MSG_RECALL.ReceiveError, mNetTag + "-" + e.ToString()));
     }
 }
            private void DrawGates()
            {
                if (GUILayout.Button("Add Gate"))
                {
                    if (gates.Count >= stages.Count - 1)
                    {
                        DLog.LogError(string.Format(
                                          "Cannot add gate because gate count is {0} and stage count is {1}",
                                          gates.Count, stages.Count
                                          ));
                        return;
                    }

                    Gate g = new Gate();
                    gates.Add(g);
                }

                Gate removedGate = null;

                for (int kIndex = 0; kIndex < gates.Count; kIndex++)
                {
                    Gate g = gates[kIndex];
                    g.SetOrder(kIndex + 1);
                    g.OnGUI();
                    if (g.IsRemoved)
                    {
                        removedGate = g;
                    }
                }

                if (removedGate != null)
                {
                    gates.Remove(removedGate);
                }
            }
示例#3
0
 public void Save()
 {
     LitEngine.IO.AESWriter twriter = null;
     try
     {
         string tfullname = GameCore.AppPersistentAssetsPath + cDatafile;
         string tempfile  = tfullname + ".temp";
         twriter = new LitEngine.IO.AESWriter(tempfile);
         int ttableCount = tableList.Count;
         twriter.WriteInt(ttableCount);
         for (int i = 0; i < ttableCount; i++)
         {
             DataTable ttable = tableList[i];
             ttable.Save(twriter);
         }
         twriter.Flush();
         twriter.Close();
         twriter = null;
         if (File.Exists(tfullname))
         {
             File.Delete(tfullname);
         }
         File.Copy(tempfile, tfullname);
     }
     catch (System.Exception _e)
     {
         DLog.LogError(_e.ToString());
     }
     if (twriter != null)
     {
         twriter.Close();
     }
 }
示例#4
0
            virtual public object CallScriptFunctionByNameParams(string _FunctionName, params object[] _prams)
            {
#if LITDEBUG
                try
                {
#endif
                if (mObject == null || mScriptType == null || mCodeTool == null)
                {
                    return(null);
                }
                int tpramcount     = _prams != null ? _prams.Length : 0;
                MethodBase tmethod = GetMethod(_FunctionName, tpramcount);
                if (tmethod == null)
                {
                    return(null);
                }
                return(tmethod.Invoke(_prams));

#if LITDEBUG
            }

            catch (Exception _erro)
            {
                DLog.LogError(string.Format("[{0}->{1}] [GameObject:{2}] Error:{3}", mScriptClass, _FunctionName, gameObject.name, _erro.ToString()));
            }
#endif
                return(null);
            }
示例#5
0
        private void Update()
        {
            if (!IsDone)
            {
                return;
            }

            System.Action <string, string, byte[]> tdelegate = mDelgate;
            string tkey   = mKey;
            string terror = Error;

            byte[] tbuffer = RecBuffer;
            Dispose();
            try
            {
                if (tdelegate != null)
                {
                    tdelegate(tkey, terror, tbuffer);
                }
            }
            catch (System.Exception _error)
            {
                DLog.LogError(_error);
            }
        }
        public string GetPlatformPath()
        {
            if (string.IsNullOrWhiteSpace(platformPath))
            {
                switch (Application.platform)
                {
                case RuntimePlatform.IPhonePlayer:
                case RuntimePlatform.tvOS:
                case RuntimePlatform.OSXPlayer:
                    platformPath = "ios";
                    break;

                case RuntimePlatform.Android:
                    platformPath = "android";
                    break;

                case RuntimePlatform.LinuxEditor:
                case RuntimePlatform.OSXEditor:
                case RuntimePlatform.WindowsEditor:
                    platformPath = "editor";
                    break;

                default:
                    platformPath = Application.platform.ToString();
                    break;
                }
                DLog.LogError("UpdateManager未设置 platform,启用默认设置. platformPath = " + platformPath);
            }
            return(platformPath);
        }
示例#7
0
        virtual public void UpdateRecMsg()
        {
            if (StopUpdateRecMsg)
            {
                return;
            }
            if (receiveOutput != null)
            {
                return;
            }

            mResultDataList.Switch();

            int i = mResultDataList.PopCount;

            while (i > 0)
            {
                try
                {
                    ReceiveData trecdata = (ReceiveData)mResultDataList.Dequeue();
                    Call(trecdata.Cmd, trecdata);
                    i--;
                    if (trecdata.useCache)
                    {
                        cacheRecDatas.Enqueue(trecdata);
                    }
                }
                catch (Exception _error)
                {
                    DLog.LogError(_error.ToString());
                }
            }
        }
示例#8
0
        override protected void Processingdata(int _len, byte[] _buffer)
        {
            try
            {
                if (cacheBytesQue.PopCount <= 0)
                {
                    cacheBytesQue.Switch();
                }

                CacheByteObject dst = null;
                if (cacheBytesQue.PopCount > 0)
                {
                    dst = cacheBytesQue.Dequeue();
                    dst.Initialize();
                }
                else
                {
                    dst = new CacheByteObject()
                    {
                        bytes = new byte[cacheByteLen]
                    };
                }
                dst.length = _len;
                Buffer.BlockCopy(_buffer, 0, dst.bytes, 0, _len);
                recvQueue.Push(dst);
            }
            catch (Exception e)
            {
                DLog.LogError(mNetTag + "-" + e.ToString());
            }
        }
示例#9
0
        static public object Load(string pFile, object pValue)
        {
            LitEngine.IO.AESReader tloader = null;
            object ret = pValue;

            try
            {
                string tfullname = GameCore.AppPersistentAssetsPath + pFile;
                if (!File.Exists(tfullname))
                {
                    return(ret);
                }
                tloader = new LitEngine.IO.AESReader(tfullname);
                ret     = ReadField(tloader, pValue, null);

                tloader.Close();
                tloader = null;
            }
            catch (System.Exception pErro)
            {
                DLog.LogError(pErro.ToString());
            }

            if (tloader != null)
            {
                tloader.Close();
            }
            return(ret);
        }
示例#10
0
        private void TriggerOnGroundLandingEvents()
        {
            List <JumpAction.Event> events = jumpAction.FindEvents(
                JumpAction.Event.TriggerType.OnGroundLanding
                );

            for (int kIndex = 0; kIndex < events.Count; kIndex++)
            {
                JumpAction.Event            e  = events[kIndex];
                JumpAction.Event.ActionType at = e.ShowActionType();
                switch (at)
                {
                case JumpAction.Event.ActionType.CameraFx:
                    JumpAction.CameraFxEvent cfe    = (JumpAction.CameraFxEvent)e;
                    CameraAction.BaseFx      bf     = cfe.fx;
                    CameraAction.FxType      fxType = bf.ShowFxType();
                    switch (fxType)
                    {
                    case CameraAction.FxType.Shake:
                        CameraAction.ShakeFx sf = (CameraAction.ShakeFx)bf;
                        environment.ShakeCamera(
                            sf.strength, sf.duration, sf.vibrato, sf.smoothness, sf.randomness,
                            sf.useRandomInitialAngel, sf.rotation
                            );
                        break;

                    default:
                        throw new Exception("Missing logic to handle camera fx of type " + fxType);
                    }

                    break;

                case Event.ActionType.Vfx:
                    JumpAction.VfxEvent ve = (JumpAction.VfxEvent)e;
                    VfxAction.VfxType   vt = ve.fx.ShowVfxType();
                    switch (vt)
                    {
                    case VfxAction.VfxType.SpawnPrefab:
                        vfxLogic = new Vfxs.Vfx.SpawnPrefab(
                            5, (VfxAction.SpawnPrefabVfx)ve.fx,
                            new DefaultVfxGameObjectFactory(),
                            character,
                            SkillCastingSource.FromUserInput(),
                            environment.GetCamera(), environment, parentSkill
                            );
                        Timing.RunCoroutine(UpdateVfxLogic(vfxLogic));
                        break;
                    }
                    break;

                case Event.ActionType.Id:
                    parentSkill.TriggerEventWithId(((JumpAction.IdEvent)e).id);
                    break;

                default:
                    DLog.LogError("Missing logic to handle event of action type of " + at);
                    break;
                }
            }
        }
示例#11
0
        override protected void PushRecData(byte[] pBuffer, int pSize)
        {
            try
            {
                ReceiveData tssdata  = null;
                bool        tissmall = pSize <= cacheObjectLength;

                if (tissmall && cacheRecDatas.PopCount <= 0)
                {
                    cacheRecDatas.Switch();
                }

                if (cacheRecDatas.PopCount > 0 && tissmall)
                {
                    tssdata = cacheRecDatas.Dequeue();
                }
                else
                {
                    int tlen = tissmall ? cacheObjectLength : pSize;
                    tssdata          = new ReceiveData(tlen);
                    tssdata.useCache = tissmall;
                }
                tssdata.CopyBuffer(pBuffer, 0);
                mResultDataList.Enqueue(tssdata);
                DebugMsg(tssdata.Cmd, tssdata.Data, 0, tssdata.Len, "接收-ReceiveData");
            }
            catch (Exception e)
            {
                DLog.LogError(mNetTag + "-" + e.ToString());
            }
        }
示例#12
0
        public void RemoveObject(TKey key)
        {
            TValue v = null;

            if (_coll.TryGetValue(key, out v))
            {
                foreach (var item in compDic)
                {
                    item.Value.Remove(v);
                }
                _valList.Remove(v);
                _coll.Remove(key);
                if (v is IUpdate)
                {
                    _updateItems.Remove((IUpdate)v);
                }
                else if (v is IFixedUpdate)
                {
                    _fixedUpdateItems.Remove((IFixedUpdate)v);
                }
            }
            else
            {
                DLog.LogError(key.ToString() + " 不存在");
            }
        }
示例#13
0
            override public bool IsDone()
            {
                if (!base.IsDone())
                {
                    return(false);
                }
                if (mLoadFinished)
                {
                    return(true);
                }
                if (mReq == null)
                {
                    DLog.LogError("erro Resources->loadasync.载入过程中,错误的调用了清除函数。AssetName = " + mAssetName);
                    mLoadFinished = true;
                    return(false);
                }

                if (!mReq.isDone)
                {
                    mProgress = mReq.progress;
                    return(false);
                }
                mProgress     = mReq.progress;
                mAssetsBundle = mReq.asset;
                mAsset        = mReq.asset;
                mReq          = null;
                if (mAsset == null)
                {
                    DLog.LogError("erro Resources->loadasync.载入失败! mPathName = " + mPathName);
                }
                LoadEnd();
                return(true);
            }
示例#14
0
            virtual protected bool TCPConnect()
            {
                bool             ret   = false;
                List <IPAddress> tipds = GetServerIpAddress(mHostName);

                if (tipds.Count == 0)
                {
                    DLog.LogError("IPAddress List.Count = 0!");
                }

                foreach (IPAddress tip in tipds)
                {
                    try
                    {
                        DLog.Log(string.Format("[开始连接]" + " HostName:{0} IpAddress:{1} AddressFamily:{2}", mHostName, tip.ToString(), tip.AddressFamily.ToString()));
                        mSocket = new Socket(tip.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                        ChoseSocketTimeOutAndBuffer();
                        mSocket.Connect(tip, mPort);
                        DLog.Log("连接成功!");
                        ret = true;
                        break;
                    }
                    catch (Exception e)
                    {
                        DLog.LogError(string.Format("[网络连接异常]" + " HostName:{0} IpAddress:{1} AddressFamily:{2} ErrorMessage:{3}", mHostName, tip.ToString(), tip.AddressFamily.ToString(), e.ToString()));
                    }
                }

                return(ret);
            }
示例#15
0
        public static void DoLogs(Object context)
        {
            // Examples of DLog.Log()
            DLog.Log("Log a message");
            DLog.Log("Log a message with a specific color", Color.blue);
            DLog.Log("Log a message with a user-defined color", new Color(0f, 0.5f, 0f));

            // Examples of DLog.LogWarning()
            DLog.LogWarning("Log a warning message");
            DLog.LogWarning("Log a warning message with a specific color", Color.yellow);
            DLog.LogWarning("Log a warning message with a user-defined color", new Color(1f, 0.5f, 0.25f));

            // Examples of DLog.LogError()
            DLog.LogError("Log an error message");
            DLog.LogError("Log an error message with a specific color", Color.red);
            DLog.LogError("Log an error message with a user-defined color", new Color(1f, 0f, 1f));

            // Examples of DLog.LogException()
            DLog.LogException(new System.Exception("Log an exception message"));
            DLog.LogException(new System.Exception("Log an exception message with a specific color"), Color.red);
            DLog.LogException(new System.Exception("Log an exception message with a user-defined color"), new Color(1f, 0f, 1f));

            // Examples of logging With Context
            DLog.Log("Log a message with a context", context);
            DLog.Log("Log a message with a specific color and context", Color.green, context);

            DLog.LogWarning("Log a warning message with a context", context);
            DLog.LogWarning("Log a warning message with a specific color and context", Color.cyan, context);

            DLog.LogError("Log an error message with a context", context);
            DLog.LogError("Log an error message with a specific color and context", Color.red, context);

            DLog.LogException(new System.Exception("Log an exception message with a context"), context);
            DLog.LogException(new System.Exception("Log an exception message with a specific color and context"), Color.red, context);
        }
示例#16
0
        static public void Save(string pFIle, object pTarget)
        {
            LitEngine.IO.AESWriter twriter = null;
            string tfullname = GameCore.AppPersistentAssetsPath + pFIle;
            string tempfile  = tfullname + ".temp";

            try
            {
                twriter = new LitEngine.IO.AESWriter(tempfile);

                SaveByField(twriter, new NeedToSave(pTarget.GetType().FullName, DataType.DataObject), pTarget);

                twriter.Flush();
                twriter.Close();
                twriter = null;
                if (File.Exists(tfullname))
                {
                    File.Delete(tfullname);
                }
                File.Copy(tempfile, tfullname);
            }
            catch (System.Exception pErro)
            {
                DLog.LogError(pErro.ToString());
            }

            if (twriter != null)
            {
                twriter.Close();
            }
        }
示例#17
0
        private void Init()
        {
            if (mInited)
            {
                return;
            }
            mInited = true;

            updateData = new UpdateData();
            TextAsset datatxt = Resources.Load <TextAsset>(upateMgrData);

            if (datatxt != null)
            {
                UnityEngine.JsonUtility.FromJsonOverwrite(datatxt.text, updateData);
            }
            else
            {
                StringBuilder tstrbd = new StringBuilder();
                tstrbd.AppendLine(string.Format("加载版本文件失败.请检查Resources目录下是否有 {0}.txt 文件", upateMgrData));
                tstrbd.AppendLine("格式如下:");
                tstrbd.AppendLine("{");
                tstrbd.AppendLine("\"version\":\"1\",");
                tstrbd.AppendLine("\"server\":\"http://localhost/Resources/\"");
                tstrbd.AppendLine("}");

                DLog.LogError(tstrbd.ToString());
            }
        }
示例#18
0
        static byte[] LoadBytesFromBundle(string pFileName)
        {
            byte[]      ret         = null;
            string      tfullname   = GetFullPath(pFileName);
            AssetBundle tinfobundle = AssetBundle.LoadFromFile(tfullname);

            if (tinfobundle != null)
            {
                TextAsset tass = tinfobundle.LoadAsset <TextAsset>(pFileName);
                if (tass != null)
                {
                    ret = tass.bytes;
                }
                else
                {
                    DLog.LogErrorFormat("AssetBundle.LoadAsset<TextAsset>() 文件读取失败 name = {0}", tfullname);
                }
                tinfobundle.Unload(false);
            }
            else
            {
                DLog.LogError("文件读取失败 name = " + tfullname);
            }
            return(ret);
        }
示例#19
0
        protected List <IPAddress> GetServerIpAddress(string _hostname)
        {
            List <IPAddress> ret = new List <IPAddress>();

            try
            {
                IPAddress[] tips = Dns.GetHostEntry(mHostName).AddressList;
                DLog.Log("HostName: " + mHostName + " Length:" + tips.Length);
                for (int i = 0; i < tips.Length; i++)
                {
                    // DLog.Log( "IpAddress: " + tips[i].ToString() + " AddressFamily:" + tips[i].AddressFamily.ToString());

                    if (tips[i].AddressFamily == AddressFamily.InterNetwork)
                    {
                        ret.Insert(0, tips[i]);
                    }
                    else
                    {
                        ret.Add(tips[i]);
                    }
                }
            }
            catch (Exception e)
            {
                DLog.LogError(string.Format("[获取IPAddress失败]" + " HostName:{0} IP:{1} ErrorMessage:{2}", mHostName, ret.Count, e.ToString()));
            }
            return(ret);
        }
示例#20
0
        public static GameCore AppChangeFromFile(string _nowapp, string _nextapp, string _scriptFileName, string _Class, string _startFun)
        {
            if (IsChanging)
            {
                DLog.LogError("App is Changing.");
                return(null);
            }
            if (!string.IsNullOrEmpty(_nowapp))
            {
                DestroyGameCore(_nowapp);
            }

            UnityEngine.GameObject tobj = new UnityEngine.GameObject("Temp-" + _nextapp);

            RootScript trs = tobj.AddComponent <RootScript>();

            trs.APPNAME        = _nextapp;
            trs.ScriptFileName = _scriptFileName;
            trs.StartClass     = _Class;
            trs.StartFun       = _startFun;

            trs.InitScript();

            return(CreatGameCore(trs.APPNAME));
        }
示例#21
0
            virtual public void CallFunctionVoid(string _FunctionName)
            {
#if LITDEBUG
                try
                {
#endif
                if (mObject == null || mScriptType == null || mCodeTool == null)
                {
                    return;
                }
                MethodBase tmethod = GetMethod(_FunctionName);
                if (tmethod == null)
                {
                    return;
                }
                tmethod.Call();
#if LITDEBUG
            }

            catch (Exception _erro)
            {
                DLog.LogError(string.Format("[{0}->{1}] [GameObject:{2}] Error:{3}", mScriptClass, _FunctionName, gameObject.name, _erro.ToString()));
            }
#endif
            }
示例#22
0
            public void LoadResourcesAsync(string _key, string _AssetsName, System.Action <string, object> _callback)
            {
                if (_AssetsName.Length == 0)
                {
                    DLog.LogError("LoadResourcesBundleByRelativePathNameAsync -- _AssetsName 的长度不能为空");
                }
                if (_callback == null)
                {
                    DLog.LogError("LoadResourcesBundleByRelativePathNameAsync -- CallBack Fun can not be null");
                    return;
                }
                _AssetsName = BaseBundle.DeleteSuffixName(_AssetsName).ToLower();
                if (mBundleList.Contains(_AssetsName))
                {
                    if (mBundleList[_AssetsName].Loaded)
                    {
                        if (mBundleList[_AssetsName].Asset == null)
                        {
                            DLog.LogError("ResourcesBundleAsync-erro in vector。文件载入失败,请检查文件名:" + _AssetsName);
                        }

                        mBundleList[_AssetsName].Retain();
                        _callback(_key, mBundleList[_AssetsName].Asset);
                    }
                    else
                    {
                        CreatTaskAndStart(_key, mBundleList[_AssetsName], _callback, true);
                        ActiveLoader(true);
                    }
                }
                else
                {
                    LoadBundleAsync(new ResourcesBundleAsync(_AssetsName), _key, _callback, true);
                }
            }
示例#23
0
        public void LoadProjectByBytes(byte[] _dll, byte[] _pdb)
        {
            try
            {
                switch (mUseSystemAssm)
                {
                case UseScriptType.UseScriptType_LS:
                {
                    System.IO.MemoryStream msDll = new System.IO.MemoryStream(_dll);
                    System.IO.MemoryStream msPdb = new System.IO.MemoryStream(_pdb);
                    Env.LoadAssembly(msDll, msPdb, new Mono.Cecil.Pdb.PdbReaderProvider());
                }
                break;

                case UseScriptType.UseScriptType_System:
                {
                    ((CodeTool_SYS)CodeTool).AddAssemblyType(_dll, _pdb);
                }
                break;
                }
                ProjectLoaded = true;
            }
            catch (Exception err)
            {
                DLog.LogError("加载脚本出现错误:" + err);
            }
        }
示例#24
0
            public BaseBundle WWWLoad(string _key, string _FullName, System.Action <string, object> _callback)
            {
                if (_callback == null)
                {
                    DLog.LogError("assetsbundle -- CallBack Fun can not be null");
                    return(null);
                }

                if (mBundleList.Contains(_FullName))
                {
                    if (mBundleList[_FullName].Loaded)
                    {
                        if (mBundleList[_FullName].Asset == null)
                        {
                            DLog.LogError("WWWLoad-erro in vector。文件载入失败,请检查文件名:" + _FullName);
                        }
                        mBundleList[_FullName].Retain();
                        _callback(_key, mBundleList[_FullName].Asset);
                    }
                    else
                    {
                        CreatTaskAndStart(_key, mBundleList[_FullName], _callback, true);
                        ActiveLoader(true);
                    }
                }
                else
                {
                    LoadBundleAsync(new WWWBundle(_FullName), _key, _callback, true);
                }
                return(mBundleList[_FullName]);
            }
示例#25
0
        private UIBase LoadUI(string _uiname)
        {
            Object tres = Resources.Load(sUIFolder + _uiname);

            if (tres == null)
            {
                return(null);
            }
            ((GameObject)tres).SetActive(false);
            GameObject tui = ((GameObject)GameObject.Instantiate(tres));

            tui.name = tui.name.Replace("(Clone)", "");

            tui.transform.SetParent(transform, false);

            UIBase tuiScript = tui.GetComponent <UIBase>();

            if (tuiScript == null)
            {
                DLog.LogError("UI未能找到 UIBase 接口.");
                GameObject.DestroyImmediate(tui);
                return(null);
            }
            tuiScript.Init(_uiname);
            mUiCache.Add(_uiname, tuiScript);

            return(tuiScript);
        }
示例#26
0
        public static bool Parse <T>(this string text, out T ret)
            where T : struct, IComparable, IFormattable, IConvertible
        {
            string key = typeof(T) + "_" + text;

            if (!cache.ContainsKey(key))
            {
                T    def     = default(T);
                bool success = false;
                try
                {
                    def     = (T)Enum.Parse(typeof(T), text);
                    success = true;
                }
                catch (Exception e)
                {
                    DLog.LogError(e);
                    ret = default(T);
                    return(false);
                }

                cache.Add(key, new Ret(success, def));
            }

            Ret r = cache[key];

            ret = (T)r.value;
            return(r.success);
        }
            private void DrawActivators()
            {
                if (GUILayout.Button("Add Stage activator"))
                {
                    if (stageActivators.Count >= stages.Count - 1)
                    {
                        DLog.LogError(string.Format(
                                          "Cannot add stage activator because stage activator count is {0} and stage count is {1}",
                                          stageActivators.Count, stages.Count
                                          ));
                        return;
                    }

                    StageActivator sa = new StageActivator();
                    stageActivators.Add(sa);
                }

                StageActivator removedSa = null;

                for (int kIndex = 0; kIndex < stageActivators.Count; kIndex++)
                {
                    StageActivator sa = stageActivators[kIndex];
                    sa.SetOrder(kIndex + 1);
                    sa.OnGUI();
                    if (sa.IsRemoved)
                    {
                        removedSa = sa;
                    }
                }

                if (removedSa != null)
                {
                    stageActivators.Remove(removedSa);
                }
            }
示例#28
0
        private void InitGameCore(UseScriptType _scripttype)
        {
            if (!CheckInited(false))
            {
                DLog.LogError("不允许重复初始化GameCore,请检查代码");
                return;
            }
            SetPath();

            GameObject tobj = new GameObject("GameUpdateManager-" + AppName);

            GameObject.DontDestroyOnLoad(tobj);
            GManager = tobj.AddComponent <GameUpdateManager>();

            tobj = new GameObject("PlayAudioManager-" + AppName);
            GameObject.DontDestroyOnLoad(tobj);
            AudioManager = tobj.AddComponent <PlayAudioManager>();

            tobj = new GameObject("LoaderManager-" + AppName);
            GameObject.DontDestroyOnLoad(tobj);
            LManager = tobj.AddComponent <LoaderManager>();
            LManager.Init(AppName, AppPersistentResDataPath, AppStreamingAssetsResDataPath, AppResourcesDataPath);

            CManager = new CorotineManager(AppName, this);
            SManager = new ScriptManager(AppName, _scripttype);

            mIsInited = true;
        }
示例#29
0
            override public void StartLoad()
            {
                if (mStarted)
                {
                    DLog.LogError("队列已经开始载入-" + mkey);
                    return;
                }
                mStarted  = true;
                mMaxCount = mList.Count;
                if (mMaxCount == 0)
                {
                    Finished();
                    return;
                }
                List <string> tlist = new List <string>(mList.Keys);

                for (int i = 0; i < mMaxCount; i++)
                {
                    string tkey = tlist[i];
                    if (mList.ContainsKey(tkey))
                    {
                        mList[tkey].StartLoad();
                    }
                }
            }
示例#30
0
 virtual public void InitScript(string _class, string _AppName)
 {
     if (_class.Length == 0 || mInitScript)
     {
         return;
     }
     if (_AppName.Equals(cNeedSetAppName))
     {
         DLog.LOGColor(DLogType.Error, string.Format("必须设置正确的AppName.Class = {0},GameObject = {1}", _class, gameObject.name), LogColor.YELLO);
         return;
     }
     try {
         mAppName     = _AppName;
         mCore        = AppCore.App[mAppName];
         mCodeTool    = mCore.SManager.CodeTool;
         mScriptClass = _class;
         mScriptType  = mCodeTool.GetLType(mScriptClass);
         mObject      = mCodeTool.GetCSLEObjectParmasByType(mScriptType, this);
         InitParamList();
         mCore.AddScriptInterface(this);
         CallScriptFunctionByName("Awake");
         mInitScript = true;
     }
     catch (Exception _erro)
     {
         DLog.LogError(string.Format("脚本初始化出错:Class = {0},AppName = {1},GameObject = {2},InitScript ->{3}", mScriptClass, mAppName, gameObject.name, _erro.ToString()));
     }
 }