protected override void OnCreate() { InitTrans(); BindListener(MainMenuButton_Button, delegate { Jyx2_UIManager.Instance.HideUI("SystemUIPanel"); List <string> selectionContent = new List <string>() { "是", "否" }; Jyx2_UIManager.Instance.ShowUI("ChatUIPanel", ChatType.Selection, "主角", "将丢失未保存进度,是否继续?", selectionContent, new Action <int>((index) => { if (index == 0) { LoadingPanel.Create("0_GameStart", () => { }); } })); }); //返回游戏 BindListener(QuitGameButton_Button, () => { Jyx2_UIManager.Instance.HideUI("SystemUIPanel"); //Application.Quit(); }); BindListener(SaveButton_Button, delegate { Jyx2_UIManager.Instance.ShowUI("SavePanel", new Action <int>((index) => { var levelMaster = FindObjectOfType <LevelMaster>(); levelMaster.OnManuelSave(index); })); }); BindListener(LoadButton_Button, () => { Jyx2_UIManager.Instance.ShowUI("SavePanel", new Action <int>((index) => { StoryEngine.DoLoadGame(index); Jyx2_UIManager.Instance.HideUI("SystemUIPanel"); })); }); BindListener(GraphicSettingsButton_Button, delegate { Jyx2_UIManager.Instance.HideUI("SystemUIPanel"); //runTimeHelper.ShowGraphicSettingsPanel(); }); BindListener(MainBg_Button, delegate { Jyx2_UIManager.Instance.HideUI("SystemUIPanel"); }); }
//加载战斗 public static void LoadBattle(int battleId, Action <BattleResult> callback) { var battle = ConfigTable.Get <Jyx2Battle>(battleId); string sceneName = "Jyx2Battle_" + battle.MapId; if (!Application.CanStreamedLevelBeLoaded(sceneName)) { sceneName = "BattleScene_hufeiju"; } LoadingPanel.Create(sceneName, () => { GameObject obj = new GameObject("BattleLoader"); var battleLoader = obj.AddComponent <BattleLoader>(); battleLoader.m_BattleId = battleId; battleLoader.Callback = callback; }); }
/* * internal void PopulateUsers(bool refresh, bool resort) * { * this.lvUsers.BeginUpdate(); * * try * { * BackupSelectedItems(); * * if (refresh) * { * this.cachedUsers = null; * } * * if (this.cachedUsers == null) * { * UpdateControls(false, true); * workerReadIdentities.RunWorkerAsync(); * * Identity everyOneGroup = Context.SecurityService.ReadIdentity(SearchFactor.EveryoneApplicationGroup, * null, QueryMembership.Direct); * int usersCount = everyOneGroup.Members.Length; * UIContext.Instance.ProgressBegin(usersCount, 1); * * try * { * this.cachedUsers = new List<Identity>(); * this.lvUsers.Groups.Clear(); * * List<string> domains = new List<string>(); * * Identity[] allIdentities = Context.SecurityService.ReadIdentities(SearchFactor.Sid, * everyOneGroup.Members, * QueryMembership.None); * * string selectedDomain = cmbDomains.SelectedItem as string; * * foreach (Identity identity in allIdentities) * { * if (identity != null && identity.Type == IdentityType.WindowsUser) * { * if (!domains.Contains(identity.Domain)) * { * domains.Add(identity.Domain); * } * * if (selectedDomainIndex == 0 || Util.StrEqual(identity.Domain, selectedDomain, true)) * { * this.cachedUsers.Add(identity); * this.lvUsers.Groups.Add(identity.Domain, identity.Domain); * } * } * * UIContext.Instance.ProgressDoStep(); * } * * blockSelectedChange = true; * try * { * cmbDomains.Items.Clear(); * cmbDomains.Items.Add(string.Empty); * domains.ForEach(domain => cmbDomains.Items.Add(domain)); * * cmbDomains.SelectedIndex = selectedDomainIndex; * } * finally * { * blockSelectedChange = false; * } * } * finally * { * UIContext.Instance.ProgressEnd(); * } * } * * if (resort) * { * SortListData(); * } * * this.lvUsers.Visible = true; * this.lvUsers.Items.Clear(); * UIContext.Instance.ProgressBegin(this.cachedUsers.Count, 1); * this.cachedUsers.ForEach(user => * { * ListViewItem viewItem = this.lvUsers.Items.Add(user.AccountName); * viewItem.ImageIndex = 0; * viewItem.Tag = user; * viewItem.SubItems.Add(user.DisplayName); * viewItem.SubItems.Add(user.Sid); * viewItem.SubItems.Add(user.MailAddress); * viewItem.SubItems.Add(user.Description); * viewItem.Group = this.lvUsers.Groups[user.Domain]; * * UIContext.Instance.ProgressDoStep(); * }); * } * finally * { * this.lvUsers.EndUpdate(); * UIContext.Instance.ProgressEnd(); * RestoreSelectedItems(); * * if (!firstTimeLoaded) * { * firstTimeLoaded = true; * } * } * } */ #endregion old PopulateUsers internal void PopulateUsers(bool refresh, bool resort) { this.lvUsers.BeginUpdate(); try { BackupSelectedItems(); if (refresh) { this.cachedUsers = null; } this.lvUsers.Visible = true; this.lvUsers.Items.Clear(); if (this.cachedUsers == null) { if (!workerReadIdentities.IsBusy && !workerReadIdentities.CancellationPending) { UpdateControls(false); if (loadingPanel == null) { loadingPanel = LoadingPanel.Create(new LoadingPanelSettings { Message = "Loading users...", OwnerControl = this.panelWorkingArea, OnCancelAction = CancelLoadingUsers, ProgressEnabled = true }); } else { loadingPanel.NotifyStart("Loading users..."); } workerReadIdentities.RunWorkerAsync(); return; } #region old // Identity everyOneGroup = Context.SecurityService.ReadIdentity(SearchFactor.EveryoneApplicationGroup, // null, QueryMembership.Direct); // int usersCount = everyOneGroup.Members.Length; // UIContext.Instance.ProgressBegin(usersCount, 1); // // try // { // this.cachedUsers = new List<Identity>(); // this.lvUsers.Groups.Clear(); // // List<string> domains = new List<string>(); // // Identity[] allIdentities = Context.SecurityService.ReadIdentities(SearchFactor.Sid, // everyOneGroup.Members, // QueryMembership.None); // // string selectedDomain = cmbDomains.SelectedItem as string; // // foreach (Identity identity in allIdentities) // { // if (identity != null && identity.Type == IdentityType.WindowsUser) // { // if (!domains.Contains(identity.Domain)) // { // domains.Add(identity.Domain); // } // // if (selectedDomainIndex == 0 || Util.StrEqual(identity.Domain, selectedDomain, true)) // { // this.cachedUsers.Add(identity); // this.lvUsers.Groups.Add(identity.Domain, identity.Domain); // } // } // // UIContext.Instance.ProgressDoStep(); // } // // blockSelectedChange = true; // try // { // cmbDomains.Items.Clear(); // cmbDomains.Items.Add(string.Empty); // domains.ForEach(domain => cmbDomains.Items.Add(domain)); // // cmbDomains.SelectedIndex = selectedDomainIndex; // } // finally // { // blockSelectedChange = false; // } // } // finally // { // UIContext.Instance.ProgressEnd(); // } #endregion old } if (resort) { SortListData(); } UIContext.Instance.ProgressBegin(this.cachedUsers.Count, 1); this.cachedUsers.ForEach(user => { ListViewItem viewItem = this.lvUsers.Items.Add(user.AccountName); viewItem.ImageIndex = 0; viewItem.Tag = user; viewItem.SubItems.Add(user.DisplayName); viewItem.SubItems.Add(user.Sid); viewItem.SubItems.Add(user.MailAddress); viewItem.SubItems.Add(user.Description); viewItem.Group = this.lvUsers.Groups[user.Domain]; UIContext.Instance.ProgressDoStep(); }); } finally { this.lvUsers.EndUpdate(); UIContext.Instance.ProgressEnd(); RestoreSelectedItems(); if (!firstTimeLoaded) { firstTimeLoaded = true; } } }
//加载地图 public static void LoadGameMap(GameMap map, LevelMaster.LevelLoadPara para = null, string command = "", Action callback = null) { if (para == null) { para = new LevelMaster.LevelLoadPara(); //默认生成一份 } LevelMaster.loadPara = para; //存储结构 if (GameRuntimeData.Instance != null) { //存储上一个地图 GameRuntimeData.Instance.PrevMap = GameRuntimeData.Instance.CurrentMap; //切换当前地图 if (map != null) { GameRuntimeData.Instance.CurrentMap = map.Key; //GameRuntimeData.Instance.CurrentPos = ""; //非战斗场景清理数据 if (!map.Tags.Contains("BATTLE")) { //MapRuntimeData.Instance.Clear(); //清理重复角色 //GameRuntimeData.Instance.CurrentTeam.RemoveAll(role => !GameRuntimeData.Instance.Team.Contains(role)); //从GameRuntimeData复制队伍信息到地图数据 //if (map.Tags.Contains("PLAYER_ONLY")) //{ // MapRuntimeData.Instance.AddToExploreTeam(GameRuntimeData.Instance.CurrentTeam[0]); //} //else //{ // foreach (var role in GameRuntimeData.Instance.CurrentTeam) // { // MapRuntimeData.Instance.AddToExploreTeam(role); // } //} //初始化队伍状态 //foreach (var r in MapRuntimeData.Instance.ExploreTeam) //{ // r.Hp = r.Maxhp; //} } //存档 //GameRuntimeData.Instance.GameSave(); } } if (string.IsNullOrEmpty(command)) { LoadingPanel.Create(map.Key, callback); } else { LoadingPanel.Create($"{map.Key}&{command}", callback); } }