public void ActiveBattleSkillGridCanTarget(NkBattleChar pkSendChar, BATTLESKILL_BASE BSkillBase, BATTLESKILL_DETAIL BSkillDetail) { if (pkSendChar == null || BSkillBase == null || BSkillDetail == null) { return; } eBATTLE_ALLY eBATTLE_ALLY = eBATTLE_ALLY.eBATTLE_ALLY_1; bool flag = false; switch (BSkillBase.m_nSkillTargetType) { case 1: case 2: eBATTLE_ALLY = ((pkSendChar.Ally != eBATTLE_ALLY.eBATTLE_ALLY_0) ? eBATTLE_ALLY.eBATTLE_ALLY_1 : eBATTLE_ALLY.eBATTLE_ALLY_0); break; case 3: eBATTLE_ALLY = ((pkSendChar.Ally != eBATTLE_ALLY.eBATTLE_ALLY_0) ? eBATTLE_ALLY.eBATTLE_ALLY_0 : eBATTLE_ALLY.eBATTLE_ALLY_1); break; case 4: flag = true; break; } NkBattleChar[] charArray = NrTSingleton <NkBattleCharManager> .Instance.GetCharArray(); NkBattleChar[] array = charArray; for (int i = 0; i < array.Length; i++) { NkBattleChar nkBattleChar = array[i]; if (nkBattleChar != null) { int iD = nkBattleChar.GetID(); if (iD >= 0 && charArray[iD] != null) { bool flag2 = flag || charArray[iD].Ally == eBATTLE_ALLY; if (flag2) { List <NmBattleGrid> battleGridList = this.GetBattleGridList(charArray[iD].Ally, nkBattleChar.GetStartPosIndex()); int gridPos = (int)nkBattleChar.GetGridPos(); Vector2 size = this.GetSize(charArray[iD].Ally, nkBattleChar.GetStartPosIndex()); int xMax = (int)size.x; int yMax = (int)size.y; int[] gridIndexFromCharSize = nkBattleChar.GetGridIndexFromCharSize((short)gridPos); int[] array2 = gridIndexFromCharSize; for (int j = 0; j < array2.Length; j++) { int num = array2[j]; if (pkSendChar.CanBattleSkillForTargetGrid(charArray[iD], (short)num, BSkillBase, BSkillDetail)) { if (NrTSingleton <BattleSkill_Manager> .Instance.IsTargetWeaponTypeCheck(BSkillBase, charArray[iD]) && NrGridData.IndexAccessAble(num, xMax, yMax)) { battleGridList[num].SetMode(E_RENDER_MODE.ATTACK); } } else if (battleGridList[num].GRID_MODE != E_RENDER_MODE.ACTIVE_SELECT) { battleGridList[num].SetMode(E_RENDER_MODE.DISABLE); } } } else { List <NmBattleGrid> battleGridList2 = this.GetBattleGridList(charArray[iD].Ally, nkBattleChar.GetStartPosIndex()); if (battleGridList2 != null) { int gridPos2 = (int)nkBattleChar.GetGridPos(); if (battleGridList2[gridPos2].GRID_MODE != E_RENDER_MODE.ACTIVE_SELECT) { int[] gridIndexFromCharSize2 = nkBattleChar.GetGridIndexFromCharSize((short)gridPos2); List <NmBattleGrid> battleGridList = this.GetBattleGridList(charArray[iD].Ally, nkBattleChar.GetStartPosIndex()); int[] array3 = gridIndexFromCharSize2; for (int k = 0; k < array3.Length; k++) { int index = array3[k]; battleGridList[index].SetMode(E_RENDER_MODE.DISABLE); } } } } } } } }
public void ActiveAttack(eBATTLE_ALLY Ally, short nStartPosIndex, int TargetIndex, NkBattleChar pkTarget) { NkBattleChar currentSelectChar = Battle.BATTLE.GetCurrentSelectChar(); if (currentSelectChar != null) { if (this.preTargetIndex == TargetIndex) { return; } this.preTargetIndex = TargetIndex; short num = 0; if (pkTarget != null && currentSelectChar.CanAttack(pkTarget, (short)TargetIndex, Vector3.zero, ref num) == -1) { return; } NkSoldierInfo soldierInfo = currentSelectChar.GetSoldierInfo(); E_ATTACK_GRID_TYPE aTTACKGRID = (E_ATTACK_GRID_TYPE)soldierInfo.GetAttackInfo().ATTACKGRID; Vector2 size = this.GetSize(Ally, nStartPosIndex); int xMax = (int)size.x; int yMax = (int)size.y; int[] index = BASE_BATTLE_GridData_Manager.GetInstance().GetIndex(aTTACKGRID, TargetIndex, xMax, yMax); if (index != null) { List <NmBattleGrid> battleGridList = this.GetBattleGridList(Ally, nStartPosIndex); foreach (NmBattleGrid current in battleGridList) { if (current.BUID != -1) { current.SetMode(E_RENDER_MODE.NORMAL); } else { current.SetMode(E_RENDER_MODE.DISABLE); } } int[] array = index; for (int i = 0; i < array.Length; i++) { int index2 = array[i]; if (NrGridData.IndexAccessAble(index2, xMax, yMax)) { battleGridList[index2].SetMode(E_RENDER_MODE.ATTACK); } } } } }
private void GridInputMouse() { if (this.m_Battle.CastedTarget == null) { return; } if (this.m_Battle.CastedTarget.InputControlTrigger) { return; } if (NrTSingleton <FormsManager> .Instance.IsMouseOverForm()) { return; } if (!this.m_Battle.CastedTarget.IsEnableMouseInput()) { return; } NmBattleGrid nmBattleGrid = null; bool mouseButtonUp = NkInputManager.GetMouseButtonUp(0); bool mouseButtonUp2 = NkInputManager.GetMouseButtonUp(1); if (NkRaycast.Raycast(this.mc_kBattlePickLayer)) { GameObject gameObject = NkRaycast.HIT.transform.gameObject; if (null != gameObject) { nmBattleGrid = gameObject.GetComponent <NmBattleGrid>(); if (null != nmBattleGrid) { eBATTLE_ALLY aLLY = nmBattleGrid.ALLY; short sTARTPOS_INDEX = nmBattleGrid.STARTPOS_INDEX; int iNDEX = nmBattleGrid.INDEX; short bUID = nmBattleGrid.BUID; NkBattleChar charByBUID = NrTSingleton <NkBattleCharManager> .Instance.GetCharByBUID(bUID); Vector3 pOINT = NkRaycast.POINT; BATTLESKILL_BASE bATTLESKILL_BASE = null; int num = 0; if (this.m_Battle.CastedTarget.m_iBattleSkillIndex >= 0 && this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SKILL) { NkBattleChar nkBattleChar = this.m_Battle.CastedTarget.SelectBattleSkillChar(); if (nkBattleChar == null) { return; } int skillUnique = nkBattleChar.GetSoldierInfo().SelectBattleSkillByWeapon(this.m_Battle.CastedTarget.m_iBattleSkillIndex); bATTLESKILL_BASE = NrTSingleton <BattleSkill_Manager> .Instance.GetBattleSkillBase(skillUnique); if (bATTLESKILL_BASE == null) { return; } this.m_Battle.CastedTarget.GRID_MANAGER.SetSelectBattleSkillGrid(); if (bATTLESKILL_BASE.m_nSkillTargetType == 1 || bATTLESKILL_BASE.m_nSkillTargetType == 2) { num = 1; } else if (bATTLESKILL_BASE.m_nSkillTargetType == 3) { num = 2; } else if (bATTLESKILL_BASE.m_nSkillTargetType == 4) { num = 3; } } if (this.m_Battle.CastedTarget.MyAlly != aLLY) { if (bATTLESKILL_BASE != null) { if ((num == 2 || num == 3) && bUID >= 0) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveBattleSkillGrid(aLLY, sTARTPOS_INDEX, iNDEX, bATTLESKILL_BASE.m_nSkillUnique); } } if (mouseButtonUp) { if (this.m_Battle.CastedTarget.IsEmotionSet) { this.m_Battle.CastedTarget.Send_GS_BATTLE_EMOTICON_REQ(bUID); } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_ATTACK_LAND) { this.m_Battle.CastedTarget.Send_AttackLand_Order(pOINT); this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else if (this.m_Battle.CastedTarget.m_iBattleSkillIndex >= 0 && this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SKILL) { if (num == 2 || num == 3) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveBattleSkillGrid(aLLY, sTARTPOS_INDEX, iNDEX, bATTLESKILL_BASE.m_nSkillUnique); this.m_Battle.CastedTarget.Send_BattleSkill_Order(this.m_Battle.CastedTarget.m_iBattleSkillIndex, this.m_Battle.CastedTarget.SelectBattleSkillChar(), charByBUID, pOINT, (short)iNDEX); this.m_Battle.CastedTarget.Init_BattleSkill_Input(false); this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else { Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("578"), SYSTEM_MESSAGE_TYPE.IMPORTANT_MESSAGE); } } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SEARCH) { NkBattleChar currentSelectChar = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar != null) { } this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else { if (Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_PLUNDER || Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_INFINITY) { if (Battle.BATTLE.GetCheckTargetBt() && charByBUID != null && charByBUID.GetSoldierInfo().GetHP() > 0 && charByBUID.GetCharKindInfo().GetCharKind() != 916) { Battle.BATTLE.Send_GS_BATTLE_PLUNDER_AGGROADD_REQ(charByBUID.GetBUID()); Battle.BATTLE.ClickCheckTargetBt(); Battle.BATTLE.SetTargetBtDisCount(); NrTSingleton <NkEffectManager> .Instance.AddEffect("FX_ATTACK_TARGET", charByBUID); } } else { NkBattleChar currentSelectChar2 = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar2 != null && charByBUID != null) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveAttack(aLLY, sTARTPOS_INDEX, iNDEX, charByBUID); if (charByBUID.GetSoldierInfo().GetHP() > 0) { currentSelectChar2.OrderAttackReq(charByBUID, (short)iNDEX, nmBattleGrid.GetCenter()); } } } this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } } } else { if (bATTLESKILL_BASE != null && (num == 1 || num == 3) && bUID >= 0) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveBattleSkillGrid(aLLY, sTARTPOS_INDEX, iNDEX, bATTLESKILL_BASE.m_nSkillUnique); } if (mouseButtonUp) { if (this.m_Battle.CastedTarget.IsEmotionSet) { this.m_Battle.CastedTarget.Send_GS_BATTLE_EMOTICON_REQ(bUID); } else if (this.m_Battle.CastedTarget.m_iBattleSkillIndex >= 0 && this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SKILL) { if (num == 1 || num == 3) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveBattleSkillGrid(aLLY, sTARTPOS_INDEX, iNDEX, bATTLESKILL_BASE.m_nSkillUnique); this.m_Battle.CastedTarget.Send_BattleSkill_Order(this.m_Battle.CastedTarget.m_iBattleSkillIndex, this.m_Battle.CastedTarget.SelectBattleSkillChar(), charByBUID, pOINT, (short)iNDEX); this.m_Battle.CastedTarget.Init_BattleSkill_Input(false); this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_CHANGEPOS) { NkBattleChar currentSelectChar3 = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar3 != null) { int num2 = currentSelectChar3.OrderChangePosReq(sTARTPOS_INDEX, (short)iNDEX); if (num2 < 0) { if (num2 < -1) { Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("176"), SYSTEM_MESSAGE_TYPE.NAGATIVE_MESSAGE); } else { Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("404"), SYSTEM_MESSAGE_TYPE.IMPORTANT_MESSAGE); } } } this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else if (charByBUID != null) { if (charByBUID.GetTurnState() == eBATTLE_TURN_STATE.eBATTLE_TURN_STATE_ENABLE) { this.m_Battle.CastedTarget.SelectCharacter(bUID); } this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else { this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_CHANGEPOS) { NkBattleChar currentSelectChar4 = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar4 != null) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveChangePos(nmBattleGrid.ALLY, nmBattleGrid.STARTPOS_INDEX, currentSelectChar4.GetBUID(), (short)iNDEX); } } else { this.m_Battle.CastedTarget.GRID_MANAGER.SetOver(nmBattleGrid); } } } } } if (mouseButtonUp2) { if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_CHANGEPOS) { this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("402"), SYSTEM_MESSAGE_TYPE.IMPORTANT_MESSAGE); } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SKILL) { this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; this.m_Battle.CastedTarget.Init_BattleSkill_Input(true); } } if (null == nmBattleGrid) { this.m_Battle.CastedTarget.GRID_MANAGER.SetOver(null); if (this.m_Battle.CastedTarget.m_iBattleSkillIndex < 0 && this.m_Battle.CastedTarget.REQUEST_ORDER != eBATTLE_ORDER.eBATTLE_ORDER_SKILL && this.m_Battle.CastedTarget.GetCurrentSelectChar() == null) { this.m_Battle.CastedTarget.GRID_MANAGER.InitAll(); } } }
public void InputKeyBoard() { if (this.m_Battle.CastedTarget == null) { return; } if (this.m_Battle.CastedTarget.InputControlTrigger) { return; } if (NrTSingleton <UIManager> .Instance.FocusObject != null) { return; } if (!TsPlatform.IsEditor) { return; } NkBattleChar currentSelectChar = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar != null && NkInputManager.GetKeyUp(KeyCode.Alpha1)) { int battleSkillUnique = currentSelectChar.GetSoldierInfo().SelectBattleSkillByWeapon(1); if (this.m_Battle.CastedTarget.CanSelecActionBattleSkill(battleSkillUnique)) { this.m_Battle.CastedTarget.m_iBattleSkillIndex = 1; this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_SKILL; this.m_Battle.CastedTarget.ShowBattleSkillRange(true, battleSkillUnique); } } if (NkInputManager.GetKeyUp(KeyCode.R) && this.m_Battle.CastedTarget.CurrentTurnAlly == this.m_Battle.CastedTarget.MyAlly) { this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_CHANGEPOS; Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("364"), SYSTEM_MESSAGE_TYPE.IMPORTANT_MESSAGE); } if (NkInputManager.GetKeyUp(KeyCode.Tab) && this.m_Battle.CastedTarget.CurrentTurnAlly == this.m_Battle.CastedTarget.MyAlly) { this.m_Battle.CastedTarget.SelectNextChar(); } if (NkInputManager.GetKeyUp(KeyCode.Z)) { this.m_Battle.CastedTarget.Send_GS_BF_HOPE_TO_ENDTURN_REQ(); } if (NkInputManager.GetKeyUp(KeyCode.X)) { Battle_Control_Dlg battle_Control_Dlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BATTLE_CONTROL_DLG) as Battle_Control_Dlg; if (battle_Control_Dlg == null) { return; } battle_Control_Dlg.RequestRetreat(); } if (NkInputManager.GetKeyUp(KeyCode.V) && TsPlatform.IsEditor) { this.m_Battle.CastedTarget.ChangeBattleAuto(); } if (NkInputManager.GetKeyUp(KeyCode.C)) { } if (!NkInputManager.GetKey(KeyCode.LeftShift) || NkInputManager.GetKeyUp(KeyCode.M)) { } if (!NkInputManager.GetKey(KeyCode.LeftShift) || NkInputManager.GetKeyUp(KeyCode.N)) { } }
public void SetMagic(NkBattleChar pkTarget, int BattleSkillUnique, bool bRival) { if (pkTarget == null) { return; } if (this.m_TargetChar != null && this.m_TargetChar.CastedTarget.GetBUID() == pkTarget.GetBUID()) { return; } BATTLESKILL_BASE battleSkillBase = NrTSingleton <BattleSkill_Manager> .Instance.GetBattleSkillBase(BattleSkillUnique); if (battleSkillBase != null && Battle.BATTLE.SkillDirecting != null) { this.m_bRival = false; if (this.m_goSkillDirecting != null) { UnityEngine.Object.Destroy(this.m_goSkillDirecting); this.m_goSkillDirecting = null; } if (bRival && Battle.BATTLE.SkillRivalDirecting != null) { this.m_goSkillDirecting = (GameObject)UnityEngine.Object.Instantiate(Battle.BATTLE.SkillRivalDirecting, Vector3.zero, Quaternion.identity); this.m_bRival = true; } else { this.m_goSkillDirecting = (GameObject)UnityEngine.Object.Instantiate(Battle.BATTLE.SkillDirecting, Vector3.zero, Quaternion.identity); } NkUtil.SetAllChildLayer(this.m_goSkillDirecting, GUICamera.UILayer); Vector2 screenPos = new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2)); Vector3 effectUIPos = base.GetEffectUIPos(screenPos); this.m_goSkillDirecting.transform.position = effectUIPos; string costumePortraitPath = this.GetCostumePortraitPath(pkTarget.GetSoldierInfo()); if (UIDataManager.IsUse256Texture()) { this.faceImageKey = pkTarget.GetCharKindInfo().GetPortraitFile1((int)pkTarget.GetSoldierInfo().GetGrade(), costumePortraitPath) + "_256"; } else { this.faceImageKey = pkTarget.GetCharKindInfo().GetPortraitFile1((int)pkTarget.GetSoldierInfo().GetGrade(), costumePortraitPath) + "_512"; } if (null == NrTSingleton <UIImageBundleManager> .Instance.GetTexture(this.faceImageKey)) { NrTSingleton <UIImageBundleManager> .Instance.RequestCharImage(this.faceImageKey, eCharImageType.LARGE, new PostProcPerItem(this.SetBundleImage)); } this.m_bSetFace = false; Animation componentInChildren = this.m_goSkillDirecting.GetComponentInChildren <Animation>(); if (componentInChildren != null) { this.m_fEndTime = Time.time + 10f; } else { this.m_fEndTime = Time.time + 10f; } if (TsPlatform.IsMobile && TsPlatform.IsEditor) { NrTSingleton <NkClientLogic> .Instance.SetEditorShaderConvert(ref this.m_goSkillDirecting); } this.m_goSkillDirecting.SetActive(false); } }