public bool AddPrisonsList() { int king = Controller.kingIndex; for (int i = 0; i < Informations.Instance.generalNum; i++) { GeneralInfo gInfo = Informations.Instance.GetGeneralInfo(i); if (gInfo.prisonerIdx == king) { havePrison = true; ListItem li = prisonerList.AddItem(ZhongWen.Instance.GetGeneralName1(i)); li.SetItemData(i); if (gInfo.active == 0) { li.SetSelectEnable(false); } } } if (!havePrison) { kingDialogue.SetDialogue(Informations.Instance.GetKingInfo(king).generalIdx, ZhongWen.Instance.zhaoxiang_no, MenuDisplayAnim.AnimType.InsertFromBottom); } return(havePrison); }
private void Start() { new GetGames().Execute().Subscribe(games => { games.Sort((a, b) => - (a.Order - b.Order)); foreach (var game in games) { _gameList.AddItem(GetConfiguration(game)).Subscribe(_ => { switch (game.State) { case GameState.Invited: new AcceptGameInvitation(game).Execute() .Subscribe(__ => { ViewManager.Main.Back(); }, exception => { PopupManager.Main.ShowPopup(exception.Message); }); break; case GameState.YourTurn: case GameState.TheirTurn: ViewManager.Main.ViewParameters["selected_game"] = game; ViewManager.Main.ChangeView("Board"); break; } }).AddTo(this); } }).AddTo(this); }
public void AddCityTarget(int city) { string cityName = ZhongWen.Instance.GetCityName(city); if (cityName.Length == 1) { cityName = " " + cityName + " " + " " + ZhongWen.Instance.chengTarget; } else { cityName = cityName[0] + " " + cityName[1] + " " + ZhongWen.Instance.chengTarget; } TargetData data = new TargetData(0, city); ListItem item = targetList.AddItem(cityName); item.SetItemData(data); }
void AddKingList() { for (int i = 0; i < Informations.Instance.kingNum; i++) { if (Informations.Instance.GetKingInfo(i).active == 1) { kingList.AddItem(ZhongWen.Instance.GetGeneralName1(Informations.Instance.GetKingInfo(i).generalIdx)).SetItemData(i); } } }
public void AddGeneralsList(List <int> generals) { gameObject.SetActive(true); for (int i = 0; i < generals.Count; i++) { int gIdx = generals[i]; generalsList.AddItem(ZhongWen.Instance.GetGeneralName1(gIdx)).SetItemData(gIdx); } }
void AddGeneralsList() { KingInfo kInfo = Informations.Instance.GetKingInfo(Controller.kingIndex); int kingIdx = kInfo.generalIdx; string str = ZhongWen.Instance.GetGeneralName1(kingIdx); ListItem li = generalsList.AddItem(str); li.SetItemData(kingIdx); for (int i = 0; i < kInfo.generals.Count; i++) { int gIdx = (int)kInfo.generals[i]; if (gIdx != kingIdx) { li = generalsList.AddItem(ZhongWen.Instance.GetGeneralName1(gIdx)); li.SetItemData(gIdx); } } }
void AddObjects() { KingInfo kInfo = Informations.Instance.GetKingInfo(Controller.kingIndex); for (int i = 0; i < kInfo.cities.Count; i++) { int cIdx = (int)kInfo.cities[i]; List <int> obj = Informations.Instance.GetCityInfo(cIdx).objects; if (obj.Count > 0) { for (int j = 0; j < obj.Count; j++) { string objName = ""; int code = (int)obj[j]; int idx = code & 0xFFFF; int type = code >> 16; switch (type) { case 1: objName = ZhongWen.Instance.GetEquipmentName(idx); break; case 2: objName = ZhongWen.Instance.GetArmsName(idx) + ZhongWen.Instance.bingfu; break; case 3: objName = ZhongWen.Instance.GetFormationName(idx) + ZhongWen.Instance.zhishu; break; } CityObjectsData data = new CityObjectsData(cIdx, code); ListItem li = objsList.AddItem(objName); li.SetItemData(data); } } } }
public void AddGeneralsList(int cIdx) { mode = 0; gameObject.SetActive(true); CityInfo cInfo = Informations.Instance.GetCityInfo(cIdx); for (int i = 0; i < cInfo.generals.Count; i++) { int gIdx = (int)cInfo.generals[i]; if (gIdx != Informations.Instance.GetKingInfo(Controller.kingIndex).generalIdx) { continue; } generalsList.AddItem(ZhongWen.Instance.GetGeneralName1(gIdx)).SetItemData(gIdx); } for (int i = 0; i < cInfo.generals.Count; i++) { int gIdx = cInfo.generals[i]; if (gIdx == Informations.Instance.GetKingInfo(Controller.kingIndex).generalIdx) { continue; } generalsList.AddItem(ZhongWen.Instance.GetGeneralName1(gIdx)).SetItemData(gIdx); } }
void AddGeneralsInfo() { int kingIdx = Informations.Instance.GetKingInfo(Controller.kingIndex).generalIdx; string str = GetGeneralInfo(kingIdx); ListItem li = generalsInfoList.AddItem(str); li.SetItemData(kingIdx); generalsInfoList.SetItemSelected(0, true); KingInfo kInfo = Informations.Instance.GetKingInfo(Controller.kingIndex); for (int i = 0; i < kInfo.generals.Count; i++) { int gIdx = (int)kInfo.generals[i]; if (gIdx != kingIdx) { li = generalsInfoList.AddItem(GetGeneralInfo(gIdx)); li.SetItemData(gIdx); } } }
void AddGeneralsList() { int kingIdx = Informations.Instance.GetKingInfo(Controller.kingIndex).generalIdx; generalsList.AddItem(ZhongWen.Instance.GetGeneralName1(kingIdx)).SetItemData(kingIdx); GeneralInfo gInfo = Informations.Instance.GetGeneralInfo(kingIdx); cityInfo.SetCity(gInfo.city); map.ClearSelect(); map.SelectCity(gInfo.city); KingInfo kInfo = Informations.Instance.GetKingInfo(Controller.kingIndex); for (int i = 0; i < kInfo.generals.Count; i++) { int gIdx = (int)kInfo.generals[i]; if (gIdx != kInfo.generalIdx) { generalsList.AddItem(ZhongWen.Instance.GetGeneralName1(gIdx)).SetItemData(gIdx); } } }
public void AddItemTest() { // Arrange MockRepo repo = new MockRepo(); ListController ctrl = new ListController(repo); IEnumerable <IListItem> testList1 = ctrl.GetListItems(); int size1 = testList1.Count(); // Act ctrl.AddItem(new ToDoItem("test 333")); IEnumerable <IListItem> testList2 = ctrl.GetListItems(); int size2 = testList2.Count(); // Assert Assert.AreEqual(size1 + 1, size2); }
private void Start() { new GetFriends().Execute().Subscribe(friends => { friends.Sort((a, b) => - (a.Order - b.Order)); foreach (var friend in friends) { _friendList.AddItem(GetConfiguration(friend)) .Subscribe(_ => { switch (friend.State) { case FriendState.Accepted: new CreateGame(friend).Execute() .Subscribe(__ => { ViewManager.Main.Back(); }, exception => { ViewManager.Main.Back(); PopupManager.Main.ShowPopup(exception.Message); }); break; case FriendState.Invitation: new AcceptFriendInvitation(friend).Execute() .Subscribe(__ => { ViewManager.Main.Back(); }, exception => { ViewManager.Main.Back(); PopupManager.Main.ShowPopup(exception.Message); }); break; } }).AddTo(this); } }).AddTo(this); _requestFriendButton.OnClickAsObservable().SelectMany(_ => { return(new InviteFriend(_friendNameInput.text).Execute()); }).Subscribe(_ => { }, exception => PopupManager.Main.ShowPopup(exception.Message)) .AddTo(this); }
public bool AddGeneralsList() { if (haveGeneral) { return(haveGeneral); } KingInfo kInfo = Informations.Instance.GetKingInfo(Controller.kingIndex); for (int i = 0; i < kInfo.generals.Count; i++) { int gIdx = (int)kInfo.generals[i]; GeneralInfo gInfo = Informations.Instance.GetGeneralInfo(gIdx); if (gInfo.city != -1 && gInfo.intellect >= 80 && gIdx != kInfo.generalIdx) { haveGeneral = true; ListItem li = generalsList.AddItem(ZhongWen.Instance.GetGeneralName1(gIdx)); li.SetItemData(gIdx); if (gInfo.active == 0) { li.SetSelectEnable(false); } if (generalsList.GetCount() == 1) { cityInfo.SetCity(gInfo.city); map.ClearSelect(); map.SelectCity(gInfo.city); } } } if (!haveGeneral) { bottomDialogue.SetDialogue(Informations.Instance.GetKingInfo(Controller.kingIndex).generalIdx, ZhongWen.Instance.meiyouwujiang, MenuDisplayAnim.AnimType.InsertFromBottom); } return(haveGeneral); }
public override void Show() { base.Show(); matchesList.Clear(); string fullDirectoryPath = Application.dataPath + "/" + matchDataFolder; matchNotFound.SetActive(true); try { DirectoryInfo matchDataInfo = new DirectoryInfo(fullDirectoryPath); //Debug.Log(fullPath); if (matchDataInfo != null) { FileInfo[] matchFiles = matchDataInfo.GetFiles(); foreach (FileInfo fileInfo in matchFiles) { if (fileInfo.Extension.ToLower() == ".json") { matchNotFound.SetActive(false); matchesList.AddItem(fileInfo.Name, delegate() { if (matchPlayerController.LoadJSON(fileInfo.FullName)) { if (rightPanelManager && matchPlayerPanelController) { rightPanelManager.ShowPanel(matchPlayerPanelController); if (currentMatchButtonContainer) { currentMatchButtonContainer.SetActive(true); } } } }); } } matchesList.RefreshList(); } } catch (Exception ex) { } }
public bool AddGeneralsList() { KingInfo kInfo = Informations.Instance.GetKingInfo(Controller.kingIndex); for (int i = 0; i < kInfo.generals.Count; i++) { int gIdx = (int)kInfo.generals[i]; GeneralInfo gInfo = Informations.Instance.GetGeneralInfo(gIdx); if (gInfo.king == Controller.kingIndex) { if (gInfo.level < 10) { continue; } int idx = 0; if (gInfo.level < 30) { idx = gInfo.level / 10; } else if (gInfo.level >= 40) { idx = 3; } if (gInfo.magic[idx] == -1) { haveGeneral = true; generalsList.AddItem(ZhongWen.Instance.GetGeneralName1(gIdx)).SetItemData(gIdx); } } } if (!haveGeneral) { dialogue.SetDialogue(Informations.Instance.GetKingInfo(Controller.kingIndex).generalIdx, ZhongWen.Instance.shengqian_no, MenuDisplayAnim.AnimType.InsertFromBottom); } return(haveGeneral); }
public void AddToList(T content) { controller.AddItem(content); }