Exemple #1
0
        /*
         * //config
         * public bool     _hasLogFile ;
         * public string   _startClass ;
         *
         *
         * LogFile         _logFile;
         *
         * void InvokeAwake()
         * {
         *  if ( _startClass == null || "" == _startClass)
         *  {
         *      _startClass = "Main";
         *  }
         *
         *  try
         *  {
         *      Assembly currentAssem = Assembly.GetExecutingAssembly();
         *      Type type = currentAssem.GetType(_startClass);
         *      type.InvokeMember("Awake",
         *          System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public
         *          , null, null, null);
         *      ZLog.I(this, "Invoke {0}.Awake ok", _startClass);
         *  }
         *  catch (Exception e)
         *  {
         *      ZLog.E(this, "Invoke {0}.Awake failed, reason {1}", _startClass, e.ToString());
         *  }
         * }
         */
        void Awake()
        {
            _mainEntryEvent = MainEntryEvent.Instance;
            _mainEntryEvent.SetMb(this);

            /*
             * if (_hasLogFile)
             * {
             *  _logFile = new LogFile();
             * }
             */
            ZLog.I(this, "OnAwake");

            //InvokeAwake();

            _mainEntryEvent.TriggerAwake();
        }
Exemple #2
0
        private IEnumerator _AutoUpdate()
        {
            bool running = true;

            while (running)
            {
                try
                {
                    running = Update();
                }catch (Exception e)
                {
                    ZLog.E(_mb, "{0}", e);
                }
                yield return(1);
            }
            ZLog.I(_mb, "{0} exit loop", _url);
        }
Exemple #3
0
        public void RegisertEvt(string evt)
        {
            do
            {
                if (null == evt || evt.Length == 0)
                {
                    ZLog.E(null, "evt type err");
                    break;
                }

                if (_evtSet.Contains(evt))
                {
                    ZLog.E(null, "evt {0} already register", evt);
                    break;
                }
                EventMgr.Instance.AddEvt(ViewEvtHandler, evt, true);
                _evtSet.Add(evt);
            } while (false);
        }
Exemple #4
0
        public GameObject Instantiate(string res_name, Transform parent, bool active = false)
        {
            GameObject go = null;

            do
            {
                GameObject tmpl = this.FindTmpl(res_name);
                if (null == tmpl)
                {
                    ZLog.E(null, "loader, {0} res {1} not found", _loaderName, res_name);
                    break;
                }

                go      = GameObject.Instantiate(tmpl) as GameObject;
                go.name = tmpl.name;
                go.transform.SetParent(parent, active);
            } while (false);
            return(go);
        }
Exemple #5
0
        static public UnityEngine.GameObject LoadAsGameObj(string path)
        {
            GameObject ins = null;
            var        obj = LoadResource.Load(path);

            if (obj != null)
            {
                ins = UnityEngine.Object.Instantiate(obj) as GameObject;
                if (null != ins)
                {
                    ins.name = obj.name;
                }
                else
                {
                    ZLog.E(null, "{0} Instantiate fail", path);
                }
            }

            return(ins);
        }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     ZLog.I(this, "OnStart");
     _mainEntryEvent.TriggerStart();
 }
Exemple #7
0
 public void Open(string url)
 {
     _url = url;
     ZLog.D(null, "start connect {0} ", _url);
     Open();
 }