示例#1
0
 /// <summary>
 /// 其它都准备好了,加载AssetBundle
 /// 注意:这个方法只能被 AssetBundleManager 调用
 /// 由 Manager 统一分配加载时机,防止加载过卡
 /// </summary>
 public virtual void LoadBundleAsync(EventVoid callback = null)
 {
     if (State == eLoadState.State_None)
     {
         State = eLoadState.State_Loading;
         //var e1 = this.ILoadDependsAsync();
         ////先加载依赖包
         //while (e1 != null && e1.MoveNext())
         //{
         //    yield return e1.Current;
         //}//目前Loader的依赖加载挪到AbInfo中处理
         //加载自身
         abCreateReq = LoadSelfAsync();
         LoadBundleAsync_CallBack = callback;
         abCreateReq.completed   += LoadBundleAsync_Finish;
     }
     else if (State == eLoadState.State_Error)
     {
         this.Error();
     }
     else if (State == eLoadState.State_Complete)
     {
         this.Complete();
     }
 }
示例#2
0
 /// <summary>
 /// 其它都准备好了,加载AssetBundle
 /// 注意:这个方法只能被 AssetBundleManager 调用
 /// 由 Manager 统一分配加载时机,防止加载过卡
 /// </summary>
 public virtual AssetBundle LoadBundle(System.Action <AssetBundle> callback = null)
 {
     if (State == eLoadState.State_None)
     {
         State = eLoadState.State_Loading;
         ////先加载依赖包
         //var depres = this.LoadDepends();
         var depres = eLoadState.State_Complete;//目前Loader的依赖加载挪到AbInfo中处理
         //加载自身
         LoadSelf();
         if (Bundle != null && depres == eLoadState.State_Complete)
         {
             this.Complete();
         }
         else
         {
             this.Error();
         }
     }
     else if (State == eLoadState.State_Error)
     {
         this.Error();
     }
     else if (State == eLoadState.State_Complete)
     {
         this.Complete();
     }
     if (callback != null)
     {
         callback.Invoke(Bundle);
     }
     return(Bundle);
 }
示例#3
0
        public MainForm()
        {
            InitializeComponent();

            member = new Member();

            eLoadState loadstate = member.LoadFromXML();

            this.lblNickName.Text = member.MemberID;

            if (member.Option4 == 0)
            {
                miSlientMode.Checked = true;
            }
            else if (member.Option4 == 1)
            {
                miVibrateOnly.Checked = true;
            }
            else if (member.Option4 == 2)
            {
                miVibrateRing.Checked = true;
            }

            // if the setting have been loaded then start the bluetooth service
            if (loadstate == eLoadState.Loaded)
            {
                // Start the bluetooth service
                member.StartBluetoothService();
            }
        }
示例#4
0
 //清理AB的加载器
 public virtual void Dispose(bool isUnloadAsset = false)
 {
     this.State = eLoadState.State_None;
     if (Bundle != null)
     {
         Bundle.Unload(true);
         Bundle = null;
     }
     AssetBundleLoaderManager.Instance.RemoveAsyncLoader(this);
 }
示例#5
0
 protected virtual void Error()
 {
     State = eLoadState.State_Error;
     if (Bundle != null)
     {
         Bundle.Unload(true);
         Bundle = null;
     }
     AssetBundleLoaderManager.Instance.RemoveAsyncLoader(this);
     CommonLog.Error($"Bundle:{BundleData.bundleFileName} Assets:{BundleData.assetsInfo[0].assetFullName}加载失败");
     if (parent != null)
     {
         parent.OnChildrenFinish();
     }
 }
示例#6
0
 protected virtual void Complete()
 {
     //None状态说明加载未完成,Loader被干掉了
     Profiler.BeginSample("OnAsyncLoadComplete");
     if (State == eLoadState.State_None && Bundle != null)
     {
         CommonLog.Error($"Bundle:{BundleData.bundleFileName} Assets:{BundleData.assetsInfo[0].assetFullName}加载完成,但Loader被干掉了");
         Bundle.Unload(true);
         Bundle = null;
     }
     else
     {
         // CommonLog.Log(MAuthor.HSQ,$"Bundle:{BundleData.bundleFileName} Assets:{BundleData.assetsInfo[0].assetFullName}加载完成" );
         State = eLoadState.State_Complete;
         if (parent != null)
         {
             parent.OnChildrenFinish();
         }
     }
     AssetBundleLoaderManager.Instance.RemoveAsyncLoader(this);
     Profiler.EndSample();
 }
示例#7
0
        /// <summary>
        /// Attempts to load the goAbout config file.
        /// </summary>
        /// <returns>The load state of the device</returns>
        public eLoadState LoadFromXML()
        {
            this.matches.Clear();

            if (!File.Exists(@"goAbout.xml"))
            {
                this.serverAddress = defaultServerAddress;
                loadState = eLoadState.NoLogin;
            }
            else
            {
                XmlTextReader r = new XmlTextReader(@"goAbout.xml");

                while (r.Read())
                {
                    if (r.NodeType == XmlNodeType.Element)
                    {
                        if (r.LocalName.Equals("MemberID"))
                        {
                            string str = decr(r.ReadString());
                            memberID = str;
                        }

                        if (r.LocalName.Equals("Password"))
                        {
                            string str = decr(r.ReadString());
                            password = str;
                        }

                        if (r.LocalName.Equals("MemberID"))
                        {
                            string str = decr(r.ReadString());
                            serverAddress = str;

                            if (str == "")
                                serverAddress = defaultServerAddress;
                        }

                        if (password != "" && memberID!="")
                            loadState = eLoadState.Loaded;

                        if (r.LocalName == "Options")
                        {
                            while (r.Read())
                            {
                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    if (r.LocalName == "Option1")
                                        this.option1 = Int32.Parse(r.ReadString());

                                    if (r.LocalName == "Option2")
                                        this.option2 = Int32.Parse(r.ReadString());

                                    if (r.LocalName == "Option3")
                                        this.option3 = Int32.Parse(r.ReadString());

                                    if (r.LocalName == "Option4")
                                    {
                                        this.option4 = Int32.Parse(r.ReadString());
                                        break;
                                    }
                                }
                            }
                        }

                        if (r.LocalName == "Profile")
                        {
                            while (r.Read())
                            {
                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    //if (r.LocalName == "Age")
                                    //    Member.Age = Int32.Parse(r.ReadString());

                                    ////if (r.LocalName == "Gender")
                                    // //   Member.Gender = (eGender)r.ReadString();

                                    //if (r.LocalName == "AgeSeek")
                                    //    Member.SeekAge = Int32.Parse(r.ReadString());

                                    //if (r.LocalName == "GenderSeek")
                                    //{
                                    //    Member.SeekGender = (eGender)r.ReadString();
                                    //    break;
                                    //}
                                }
                            }
                        }

                        if (r.LocalName == "Matches")
                        {
                            while (r.Read())
                            {
                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    if (r.LocalName == "Match")
                                    {
                                        Match m = null;
                                        while (r.Read())
                                        {
                                            if (r.LocalName == "MatchName")
                                                m = new Match(r.ReadString());

                                            if (r.LocalName == "MAC")
                                                m.MACAddress = r.ReadString();

                                            if (r.LocalName == "MatchTime")
                                                m.MatchDT = Convert.ToDateTime(r.ReadString());

                                            if (r.LocalName == "ConfirmedByServer")
                                            {
                                                m.ConfirmedByServer = Convert.ToBoolean(r.ReadString());
                                                matches.Add(m);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                r.Close();
                DisplayMatches();
            }

            if (this.loadState == eLoadState.NoLogin)
            {
                MainForm.pnlLogin.Visible = true;
                MainForm.LeftMenu.Text = "Done";
                MainForm.pnlLogin.Controls[2].Focus();
            }

            return loadState;
        }
示例#8
0
        /// <summary>
        /// Attempts to load the goAbout config file.
        /// </summary>
        /// <returns>The load state of the device</returns>
        public eLoadState LoadFromXML()
        {
            this.matches.Clear();

            if (!File.Exists(@"goAbout.xml"))
            {
                this.serverAddress = defaultServerAddress;
                loadState          = eLoadState.NoLogin;
            }
            else
            {
                XmlTextReader r = new XmlTextReader(@"goAbout.xml");

                while (r.Read())
                {
                    if (r.NodeType == XmlNodeType.Element)
                    {
                        if (r.LocalName.Equals("MemberID"))
                        {
                            string str = decr(r.ReadString());
                            memberID = str;
                        }

                        if (r.LocalName.Equals("Password"))
                        {
                            string str = decr(r.ReadString());
                            password = str;
                        }

                        if (r.LocalName.Equals("MemberID"))
                        {
                            string str = decr(r.ReadString());
                            serverAddress = str;

                            if (str == "")
                            {
                                serverAddress = defaultServerAddress;
                            }
                        }

                        if (password != "" && memberID != "")
                        {
                            loadState = eLoadState.Loaded;
                        }

                        if (r.LocalName == "Options")
                        {
                            while (r.Read())
                            {
                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    if (r.LocalName == "Option1")
                                    {
                                        this.option1 = Int32.Parse(r.ReadString());
                                    }

                                    if (r.LocalName == "Option2")
                                    {
                                        this.option2 = Int32.Parse(r.ReadString());
                                    }

                                    if (r.LocalName == "Option3")
                                    {
                                        this.option3 = Int32.Parse(r.ReadString());
                                    }

                                    if (r.LocalName == "Option4")
                                    {
                                        this.option4 = Int32.Parse(r.ReadString());
                                        break;
                                    }
                                }
                            }
                        }

                        if (r.LocalName == "Profile")
                        {
                            while (r.Read())
                            {
                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    //if (r.LocalName == "Age")
                                    //    Member.Age = Int32.Parse(r.ReadString());

                                    ////if (r.LocalName == "Gender")
                                    // //   Member.Gender = (eGender)r.ReadString();

                                    //if (r.LocalName == "AgeSeek")
                                    //    Member.SeekAge = Int32.Parse(r.ReadString());

                                    //if (r.LocalName == "GenderSeek")
                                    //{
                                    //    Member.SeekGender = (eGender)r.ReadString();
                                    //    break;
                                    //}
                                }
                            }
                        }

                        if (r.LocalName == "Matches")
                        {
                            while (r.Read())
                            {
                                if (r.NodeType == XmlNodeType.Element)
                                {
                                    if (r.LocalName == "Match")
                                    {
                                        Match m = null;
                                        while (r.Read())
                                        {
                                            if (r.LocalName == "MatchName")
                                            {
                                                m = new Match(r.ReadString());
                                            }

                                            if (r.LocalName == "MAC")
                                            {
                                                m.MACAddress = r.ReadString();
                                            }

                                            if (r.LocalName == "MatchTime")
                                            {
                                                m.MatchDT = Convert.ToDateTime(r.ReadString());
                                            }

                                            if (r.LocalName == "ConfirmedByServer")
                                            {
                                                m.ConfirmedByServer = Convert.ToBoolean(r.ReadString());
                                                matches.Add(m);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                r.Close();
                DisplayMatches();
            }

            if (this.loadState == eLoadState.NoLogin)
            {
                MainForm.pnlLogin.Visible = true;
                MainForm.LeftMenu.Text    = "Done";
                MainForm.pnlLogin.Controls[2].Focus();
            }

            return(loadState);
        }