public void OnUpdate() { if (teamManageOn.Value && TeamMemberObject != null && TeamMemberObject.activeInHierarchy) { var UIHome = Game.UI.Get <UIHome>(); if (UIHome == null) { return; } if (Input.GetKeyDown(teamMemberAdd.Value)) { CharacterMapping cm = GlobalLib.GetUICharacterMapping(); if (cm != null && cm.Id != GameConfig.Player && !Game.GameData.Party.Contains(cm.Id)) { Game.GameData.Party.AddParty(cm.Id, false); int count = Traverse.Create(UIHome).Property("controller").Field("characterMapping").Property("Count").GetValue <int>(); UIHome.UpdateCommunity(count); } } if (Input.GetKeyDown(teamMemberRemove.Value)) { CharacterMapping cm = GlobalLib.GetUICharacterMapping(); if (cm != null && cm.Id != GameConfig.Player && Game.GameData.Party.Contains(cm.Id)) { Game.GameData.Party.RemoveParty(cm.Id); int count = Traverse.Create(UIHome).Property("controller").Field("characterMapping").Property("Count").GetValue <int>(); UIHome.UpdateCommunity(count); } } if (Input.GetKeyDown(teamMemberRemoveAll.Value)) { foreach (var pi in Game.GameData.Party.GetRange(0, Game.GameData.Party.Count)) { if (pi != GameConfig.Player) { Game.GameData.Party.RemoveParty(pi); } } int count = Traverse.Create(UIHome).Property("controller").Field("characterMapping").Property("Count").GetValue <int>(); UIHome.UpdateCommunity(count); } if (Input.GetKeyDown(communityRemove.Value)) { CharacterMapping cm = GlobalLib.GetUICharacterMapping(); if (cm != null && cm.Id != GameConfig.Player) { Game.GameData.Community[cm.Id].isOpen = false; Game.GameData.NurturanceOrder.CloseCommunityOrder(cm.Id); if (Game.GameData.Party.Contains(cm.Id)) { Game.GameData.Party.RemoveParty(cm.Id); } Traverse.Create(UIHome).Property("controller").Method("OnShow").GetValue(); Traverse.Create(UIHome).Property("controller").Method("HideCommunity").GetValue(); Traverse.Create(UIHome).Property("controller").Method("UpdateCommunity").GetValue(); string joinPropsId = "p_npcj_" + cm.Id; if (!Game.GameData.Inventory.ContainsKey(joinPropsId)) { new RewardProps { method = Method.Add, propsId = "p_npcj_" + cm.Id, value = 1 }.GetValue(); } } } } }
private static void CreateAlphabet(char[] lettersCharacters, string alphabetName, CharacterMapping mapping) { if (Link.TryGetMapped(mapping, out Link alphabet)) { var letters = alphabet.Target; letters.WalkThroughSequence(letter => { var lowerCaseLetter = Link.Search(Net.LowerCase, Net.Of, letter); var upperCaseLetter = Link.Search(Net.UpperCase, Net.Of, letter); if (lowerCaseLetter != null && upperCaseLetter != null) { RegisterExistingLetter(lowerCaseLetter); RegisterExistingLetter(upperCaseLetter); } else { RegisterExistingLetter(letter); } }); } else { alphabet = Net.CreateMappedThing(mapping); var letterOfAlphabet = Link.Create(Net.Letter, Net.Of, alphabet); var lettersLinks = new Link[lettersCharacters.Length]; GenerateAlphabetBasis(ref alphabet, ref letterOfAlphabet, lettersLinks); for (var i = 0; i < lettersCharacters.Length; i++) { var lowerCaseCharacter = lettersCharacters[i]; SetLetterCodes(lettersLinks[i], lowerCaseCharacter, out Link lowerCaseLink, out Link upperCaseLink); _charactersToLinks[lowerCaseCharacter] = lowerCaseLink; _linksToCharacters[lowerCaseLink] = lowerCaseCharacter; if (upperCaseLink != null) { var upperCaseCharacter = char.ToUpper(lowerCaseCharacter); _charactersToLinks[upperCaseCharacter] = upperCaseLink; _linksToCharacters[upperCaseLink] = upperCaseCharacter; } } alphabet.SetName(alphabetName); for (var i = 0; i < lettersCharacters.Length; i++) { var lowerCaseCharacter = lettersCharacters[i]; var upperCaseCharacter = char.ToUpper(lowerCaseCharacter); if (lowerCaseCharacter != upperCaseCharacter) { lettersLinks[i].SetName("{" + upperCaseCharacter + " " + lowerCaseCharacter + "}"); } else { lettersLinks[i].SetName("{" + lowerCaseCharacter + "}"); } } } }
private static void CreateAlphabet(char[] lettersCharacters, string alphabetName, CharacterMapping mapping) { Link alphabet; if (Link.TryGetMapped(mapping, out alphabet)) { Link letters = alphabet.Target; letters.WalkThroughSequence(letter => { Link lowerCaseLetter = Link.Search(Net.LowerCase, Net.Of, letter); Link upperCaseLetter = Link.Search(Net.UpperCase, Net.Of, letter); if (lowerCaseLetter != null && upperCaseLetter != null) { RegisterExistingLetter(lowerCaseLetter); RegisterExistingLetter(upperCaseLetter); } else { RegisterExistingLetter(letter); } }); } else { alphabet = Net.CreateMappedThing(mapping); Link letterOfAlphabet = Link.Create(Net.Letter, Net.Of, alphabet); Link[] lettersLinks = new Link[lettersCharacters.Length]; GenerateAlphabetBasis(ref alphabet, ref letterOfAlphabet, lettersLinks); for (int i = 0; i < lettersCharacters.Length; i++) { char lowerCaseCharacter = lettersCharacters[i]; Link lowerCaseLink, upperCaseLink; SetLetterCodes(lettersLinks[i], lowerCaseCharacter, out lowerCaseLink, out upperCaseLink); CharactersToLinks[lowerCaseCharacter] = lowerCaseLink; LinksToCharacters[lowerCaseLink] = lowerCaseCharacter; if (upperCaseLink != null) { char upperCaseCharacter = char.ToUpper(lowerCaseCharacter); CharactersToLinks[upperCaseCharacter] = upperCaseLink; LinksToCharacters[upperCaseLink] = upperCaseCharacter; } } alphabet.SetName(alphabetName); for (int i = 0; i < lettersCharacters.Length; i++) { char lowerCaseCharacter = lettersCharacters[i]; char upperCaseCharacter = Char.ToUpper(lowerCaseCharacter); if (lowerCaseCharacter != upperCaseCharacter) { lettersLinks[i].SetName("{" + upperCaseCharacter + " " + lowerCaseCharacter + "}"); } else { lettersLinks[i].SetName("{" + lowerCaseCharacter + "}"); } } } }
public static void openElementUI() { Heluo.Logger.LogError("openElementUI start"); if (nonbattleChangeElement.Value) { //show结束时ctrlMartialArts还没当前角色数据,需要从ctrlhome处获得 List <CharacterMapping> characterMapping = Traverse.Create(homeController).Field("characterMapping").GetValue <List <CharacterMapping> >(); int communityIndex = Traverse.Create(homeController).Field("communityIndex").GetValue <int>(); CharacterMapping mapping = characterMapping[communityIndex]; characterInfoData = Game.GameData.Character[mapping.InfoId]; clickSkill = characterInfoData.GetSkill(characterInfoData.SpecialSkill); //不是切换功体或召唤技能 if (clickSkill == null || (clickSkill.Item.DamageType != DamageType.ChangeElement && clickSkill.Item.DamageType != DamageType.Summon)) { return; } //mp不足 if (characterInfoData.MP < clickSkill.Item.RequestMP) { string text2 = Game.Data.Get <StringTable>("SecondaryInterface1207").Text; Game.UI.AddMessage(text2, UIPromptMessage.PromptType.Normal); return; } //切换功体 if (clickSkill.Item.DamageType == DamageType.ChangeElement) { Game.MusicPlayer.Current_Volume = 0.5f; //从uibattle处获得五行盘ui UIBattle uiBattle = Game.UI.Open <UIBattle>(); WgBattleRound battle_round = uiBattle.battle_round; battle_round.gameObject.SetActive(false);//隐藏右上角的回合数 UIAttributeList attr_list = Traverse.Create(uiBattle).Field("attr_list").GetValue <UIAttributeList>(); //图层设置为最前,否则会被挡住 Game.UI.SetParent(attr_list.transform, UIForm.Depth.Front); attr_list.transform.SetAsLastSibling(); attr_list.Show(); attr_list.SetOriginElement((int)characterInfoData.Element, new Action <int>(OnElementSelect), delegate { Game.MusicPlayer.Current_Volume = 1f; }); } //召唤小熊猫,开启乖乖技能列表 else if (nonbattleUseHealSkill.Value && clickSkill.Item.DamageType == DamageType.Summon) { CharacterInfoData characterInfoData = Game.GameData.Character["in91001"]; CharacterSkillData skill = characterInfoData.Skill; Props equip = characterInfoData.Equip.GetEquip(EquipType.Weapon); if (equip == null) { return; } List <SkillData> list = new List <SkillData>(); PropsCategory propsCategory = equip.PropsCategory; foreach (string key in skill.Keys) { SkillData skillData = skill[key]; if (skillData.Item == null) { Debug.LogError("Skill表中找不到" + skillData.Id + "的文本"); } else if (!(skillData.Item.Id == characterInfoData.SpecialSkill)) { list.Add(skillData); } } if (list.Count > 0) { MartialArtsWindowInfo martialArtsWindowInfo = new MartialArtsWindowInfo(); martialArtsWindowInfo.Mapping = new CharacterMapping(); Npc npc = Game.Data.Get <Npc>("in91001"); martialArtsWindowInfo.Mapping.Id = "in91001"; martialArtsWindowInfo.Mapping.InfoId = npc.CharacterInfoId; martialArtsWindowInfo.Mapping.ExteriorId = npc.ExteriorId; martialArtsWindowInfo.Sort = list; martialArtsWindowInfo.SkillColumn = (CtrlMartialArts.UISkillColumn) 5; Game.UI.Open <UIMartialArtsWindow>().OpenWindow(martialArtsWindowInfo, null); return; } } } }