static int SkillUpgrade(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); NTGBattlePlayerController obj = (NTGBattlePlayerController)ToLua.CheckObject(L, 1, typeof(NTGBattlePlayerController)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.SkillUpgrade(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void SkillLevelUp() { if (pc.skillPoint > 0) { for (int i = 0; i < skillPriority.Length; i++) { var index = skillPriority[i]; bool canUpgrade = pc.level >= pc.skills[index].requireUpgradeLevel && pc.skills[index].level < pc.skills[index].levelCap; if (canUpgrade) { pc.SkillUpgrade(index); break; } } } }
public void doInitUI() { //yield return null; uiBattleAPI = NTGApplicationController.Instance.LuaGetTable("UIBattleAPI.Instance"); StartCoroutine(doJoystick()); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetRoleId", uiBattleAPI, localPlayerController.roleId); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateSendQuickMessage", uiBattleAPI, (PlayerChatHandler)((id, type, msg) => { var player = mainController.FindUnit(id.ToString()) as NTGBattlePlayerController; if (player != null) { if (type == 1) { if (unitUiMap.ContainsKey(player)) { NTGApplicationController.Instance.LuaCall("UIPlayerInfo", "ShowChat", unitUiMap[player], msg); } } else if (type == 2) { int camp; if (player == localPlayerController) { camp = 0; } else if (player.group == localPlayerController.group) { camp = 1; } else { camp = 2; } NTGApplicationController.Instance.LuaCall("UIBattleAPI", "ShowChatTip", uiBattleAPI, msg, player.icon, camp); } } })); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateATKDown", uiBattleAPI, (ButtonEventHandler)localPlayerController.ShootDown); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateATKUp", uiBattleAPI, (ButtonEventHandler)localPlayerController.ShootUp); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateSkill", uiBattleAPI, (ButtonClickHandler)(i => { var axis = (Vector2)uiBattleAPI["selectedAxis"]; if (localPlayerController.group == 1) { localPlayerController.SkillShoot(Convert.ToInt32(i), axis.x, axis.y); } else { localPlayerController.SkillShoot(Convert.ToInt32(i), -axis.x, -axis.y); } })); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateUpgradeSkill", uiBattleAPI, (ButtonClickHandler)(i => localPlayerController.SkillUpgrade(Convert.ToInt32(i)))); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateChooseTarget", uiBattleAPI, (ButtonClickHandler)(i => localPlayerController.SelectTarget(Convert.ToInt32(i)))); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateSkillDown", uiBattleAPI, (ButtonClickHandler)(i => { var index = Convert.ToInt32(i); if ((localPlayerController.skills[index] == null || localPlayerController.skills[index].level == 0) && index != 0) { return; } if (localPlayerController.targetUnit == null) { localPlayerController.SelectTarget(skillIndex: index); } updateSkillHint = true; StartCoroutine(doUpdateSkillHint(index)); })); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateSkillUp", uiBattleAPI, (ButtonClickHandler)(i => { updateSkillHint = false; var index = Convert.ToInt32(i); if (localPlayerController.skills[index] != null) { hintController.HintHide(); } })); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateChangeRangeColor", uiBattleAPI, (SkillCancelHandler)(c => { hintController.HintCancel(c); })); for (int i = 1; i <= 6; i++) { if (i < localPlayerController.skills.Length && localPlayerController.skills[i] != null) { NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 9, localPlayerController.skills[i].name); //Skill Name NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 0, localPlayerController.skills[i].icon); // Skill Icon NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 1, localPlayerController.skills[i].levelCap); // Max Skill Level if (i > 3) { NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 10, true, localPlayerController.roleId); // PlayerSkill Show } if (!mainController.DebugMode) { //NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 6, ""); // Desc } } else { NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 1, 1); // Max Skill Level NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 2, 0); // Skill Level NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 3, 1.0f); // Max CD NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 4, 0.0f); // CD if (i > 3) { NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillInfo", uiBattleAPI, i, 10, false); // PlayerSkill Show } else { NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetSkillUpgrade", uiBattleAPI, i, false); } } } allyList = new NTGBattlePlayerController[5]; enemyList = new NTGBattlePlayerController[5]; allyPlayerList = new ArrayList(); enemyPlayerList = new ArrayList(); foreach (var pc in unitsBase.GetComponentsInChildren <NTGBattlePlayerController>()) { if (pc.group == localPlayerController.group) { allyList[pc.position % 10] = pc; } else { enemyList[pc.position % 10] = pc; } } var ally = new ArrayList(); for (int i = 0; i < allyList.Length; i++) { if (allyList[i] != null && allyList[i].id != localPlayerController.id) { allyPlayerList.Add(allyList[i]); } if (allyList[i] != null) { ally.Add(allyList[i]); } } allyList = new NTGBattlePlayerController[ally.Count]; ally.CopyTo(allyList); for (int i = 0; i < enemyList.Length; i++) { if (enemyList[i] != null) { enemyPlayerList.Add(enemyList[i]); } } enemyList = new NTGBattlePlayerController[enemyPlayerList.Count]; enemyPlayerList.CopyTo(enemyList); for (int i = 1; i <= 4; i++) { if (i - 1 < allyPlayerList.Count) { NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetAllyInfo", uiBattleAPI, i, 5, true); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetAllyInfo", uiBattleAPI, i, 0, (allyPlayerList[i - 1] as NTGBattlePlayerController).icon); } else { NTGApplicationController.Instance.LuaCall("UIBattleAPI", "SetAllyInfo", uiBattleAPI, i, 5, false); } } miniMapRectTransform = uiBattleAPI["miniMapRT"] as RectTransform; StartCoroutine(UpdateUI()); //StartCoroutine(UpdatePlayerListUI()); StartCoroutine(UpdateUnitUI()); pvpMallAPI = NTGApplicationController.Instance.LuaGetTable("PVPMallAPI.Instance"); NTGApplicationController.Instance.LuaCall("PVPMallAPI", "BuyEquip", pvpMallAPI, (MallEventHandler)localPlayerController.BuyEquip); NTGApplicationController.Instance.LuaCall("PVPMallAPI", "SellEquip", pvpMallAPI, (MallEventHandler)localPlayerController.SellEquip); NTGApplicationController.Instance.LuaCall("PVPMallAPI", "FirstTimeOpen", pvpMallAPI, localPlayerController.roleId); StartCoroutine(doUpdateMall()); battleHeroDetailAPI = NTGApplicationController.Instance.LuaGetTable("BattleHeroDetailAPI.Instance"); NTGApplicationController.Instance.LuaCall("UIBattleAPI", "RegisterDelegateUpdateHeroDetailData", uiBattleAPI, (ButtonEventHandler)UpdateBattleHeroDetailPanel); battleInfoAPI = NTGApplicationController.Instance.LuaGetTable("BattleInfoAPI.Instance"); NTGApplicationController.Instance.LuaCall("BattleInfoAPI", "OpenPanelReceiveData", battleInfoAPI, (ButtonEventHandler)StartUpdateBattleInfo); NTGApplicationController.Instance.LuaCall("BattleInfoAPI", "ClosePanelDontReceive", battleInfoAPI, (ButtonEventHandler)StopUpdateBattleInfo); }