private void ShowBattlePosInfo() { for (int i = 0; i < 9; i++) { this.BattlePosSolSelect[i].Visible = true; this.BattlePosSolSelect[i].SetSize(this.fBattlePosSlotSize, this.fBattlePosSlotSize); this.BattlePosSolSelect[i].SetTexture("Com_I_Transparent"); ((UIButton)this.BattlePosSolSelect[i].layers[0]).Visible = true; ((UIButton)this.BattlePosSolSelect[i].layers[0]).SetSize(this.fBattlePosSlotSize, this.fBattlePosSlotSize); this.BattlePosCoverImage[i].Visible = false; this.BattlePosSolImage[i].Visible = false; this.BattlePosSolImage[i].SetLocation(this.BattlePosSolSelect[i].GetLocationX(), this.BattlePosSolSelect[i].GetLocationY()); } for (int j = 0; j < 6; j++) { NkSoldierInfo nkSoldierInfo = this.m_kBattlePosSolList[j]; if (nkSoldierInfo != null && nkSoldierInfo.IsValid()) { if (nkSoldierInfo.GetBattlePos() >= 0) { NrCharKindInfo charKindInfo = NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(nkSoldierInfo.GetCharKind()); if (charKindInfo != null) { float num = (float)charKindInfo.GetBattleSizeX() * this.fBattlePosSlotSize; float num2 = (float)charKindInfo.GetBattleSizeY() * this.fBattlePosSlotSize; if (num > this.fBattlePosSlotSize || num2 > this.fBattlePosSlotSize) { this.BattlePosSolSelect[(int)nkSoldierInfo.GetBattlePos()].SetSize(num, num2); ((UIButton)this.BattlePosSolSelect[(int)nkSoldierInfo.GetBattlePos()].layers[0]).SetSize(num, num2); if (num > this.fBattlePosSlotSize) { for (int k = 1; k < (int)charKindInfo.GetBattleSizeX(); k++) { this.BattlePosSolSelect[(int)nkSoldierInfo.GetBattlePos() + k].Visible = false; } } if (num2 > this.fBattlePosSlotSize) { for (int l = 1; l < (int)charKindInfo.GetBattleSizeY(); l++) { this.BattlePosSolSelect[(int)nkSoldierInfo.GetBattlePos() + l * 3].Visible = false; } float y = this.fBattlePosSlotSize / 2f * (float)(charKindInfo.GetBattleSizeY() - 1); this.BattlePosSolImage[(int)nkSoldierInfo.GetBattlePos()].MoveLocation(0f, y); } } this.BattlePosCoverImage[(int)nkSoldierInfo.GetBattlePos()].Visible = true; this.BattlePosSolImage[(int)nkSoldierInfo.GetBattlePos()].Visible = true; string costumePortraitPath = NrTSingleton <NrCharCostumeTableManager> .Instance.GetCostumePortraitPath(nkSoldierInfo); this.BattlePosSolImage[(int)nkSoldierInfo.GetBattlePos()].SetTexture(eCharImageType.SMALL, nkSoldierInfo.GetCharKind(), (int)nkSoldierInfo.GetGrade(), costumePortraitPath); } } } } }
private bool IsValidChangeBattlePos() { BATTLE_POS_GRID info = BASE_BATTLE_POS_Manager.GetInstance().GetInfo(0); if (info == null) { return(false); } BATTLE_POS_GRID bATTLE_POS_GRID = new BATTLE_POS_GRID(); bATTLE_POS_GRID.Set(info, 0, false); for (int i = 0; i < 6; i++) { NkSoldierInfo nkSoldierInfo = this.m_kBattlePosSolList[i]; if (nkSoldierInfo != null && nkSoldierInfo.IsValid()) { if (nkSoldierInfo.GetBattlePos() >= 0) { NrCharKindInfo charKindInfo = NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(nkSoldierInfo.GetCharKind()); if (charKindInfo != null) { if (!BASE_BATTLE_POS_Manager.GetInstance().IsEnablePos(charKindInfo, nkSoldierInfo.GetBattlePos(), bATTLE_POS_GRID)) { return(false); } bATTLE_POS_GRID.SetBUID((short)nkSoldierInfo.GetSolPosIndex(), (byte)nkSoldierInfo.GetBattlePos(), charKindInfo.GetBattleSizeX(), charKindInfo.GetBattleSizeY()); } } } } return(true); }
public void SetSolInfo(ref NkSoldierInfo pkSolinfo) { if (pkSolinfo.GetSolPosIndex() < 0 || pkSolinfo.GetSolPosIndex() >= 3) { return; } if (pkSolinfo.GetBattlePos() < 0) { return; } for (int i = 0; i < 15; i++) { if (this.m_pkSolInfo[i] == null || !this.m_pkSolInfo[i].IsValid()) { this.m_pkSolInfo[i] = pkSolinfo; this.SetSolCount(); return; } } }
private void OnClickBattlePosChange(IUIObject obj) { GS_SOLDIER_CHANGE_BATTLEPOS_REQ gS_SOLDIER_CHANGE_BATTLEPOS_REQ = new GS_SOLDIER_CHANGE_BATTLEPOS_REQ(); gS_SOLDIER_CHANGE_BATTLEPOS_REQ.MilitaryUnique = (byte)this.nCurrentMilitaryUnique; for (int i = 0; i < 6; i++) { NkSoldierInfo nkSoldierInfo = this.m_kBattlePosSolList[i]; if (nkSoldierInfo == null || !nkSoldierInfo.IsValid()) { gS_SOLDIER_CHANGE_BATTLEPOS_REQ.SolID[i] = 0L; gS_SOLDIER_CHANGE_BATTLEPOS_REQ.BattlePos[i] = -1; } else { gS_SOLDIER_CHANGE_BATTLEPOS_REQ.SolID[i] = nkSoldierInfo.GetSolID(); gS_SOLDIER_CHANGE_BATTLEPOS_REQ.BattlePos[i] = (int)nkSoldierInfo.GetBattlePos(); } } SendPacket.GetInstance().SendObject(eGAME_PACKET_ID.GS_SOLDIER_CHANGE_BATTLEPOS_REQ, gS_SOLDIER_CHANGE_BATTLEPOS_REQ); base.CloseNow(); }
private void OnClickBattlePosSolSelect(IUIObject obj) { UIRadioBtn uIRadioBtn = (UIRadioBtn)obj; if (uIRadioBtn == null || !uIRadioBtn.Value) { return; } int num = (int)uIRadioBtn.Data; short num2 = (short)num; if (num2 == this.nSelectedBattelPos) { return; } if (this.nSelectedBattelPos < 0) { this.nSelectedBattelPos = num2; bool flag = false; for (int i = 0; i < 6; i++) { NkSoldierInfo nkSoldierInfo = this.m_kBattlePosSolList[i]; if (nkSoldierInfo != null && nkSoldierInfo.IsValid()) { if (this.nSelectedBattelPos == nkSoldierInfo.GetBattlePos()) { string empty = string.Empty; NrTSingleton <CTextParser> .Instance.ReplaceParam(ref empty, new object[] { NrTSingleton <NrTextMgr> .Instance.GetTextFromInterface("1469"), "count", nkSoldierInfo.GetLevel().ToString() }); this.BattlePosSolName.Text = string.Format("{0}({1})", nkSoldierInfo.GetName(), empty); int num3 = nkSoldierInfo.GetEquipWeaponOrigin(); this.BattlePosSolWeapon1.Visible = (num3 > 0); if (num3 > 0) { this.BattlePosSolWeapon1.SetTexture(string.Format("Win_I_Weapon{0}", num3.ToString())); } num3 = nkSoldierInfo.GetEquipWeaponExtention(); this.BattlePosSolWeapon2.Visible = (num3 > 0); if (num3 > 0) { this.BattlePosSolWeapon2.SetTexture(string.Format("Win_I_Weapon{0}", num3.ToString())); } flag = true; break; } } } if (!flag) { this.BattlePosSolName.Text = string.Empty; this.BattlePosSolWeapon1.Visible = false; this.BattlePosSolWeapon2.Visible = false; } if (this.nSelectedBattelPos >= 0 && this.nSelectedBattelPos < 9) { this.BattlePosSelectedPos.SetLocation(this.BattlePosCoverImage[(int)this.nSelectedBattelPos].GetLocationX(), this.BattlePosCoverImage[(int)this.nSelectedBattelPos].GetLocationY(), -0.14f); this.BattlePosSelectedPos.Visible = true; } return; } NkSoldierInfo nkSoldierInfo2 = null; NkSoldierInfo nkSoldierInfo3 = null; short battlePos = -1; short battlePos2 = -1; for (int j = 0; j < 6; j++) { NkSoldierInfo nkSoldierInfo = this.m_kBattlePosSolList[j]; if (nkSoldierInfo != null && nkSoldierInfo.IsValid()) { if (nkSoldierInfo.GetBattlePos() >= 0) { if (num2 == nkSoldierInfo.GetBattlePos()) { nkSoldierInfo3 = nkSoldierInfo; } else if (this.nSelectedBattelPos == nkSoldierInfo.GetBattlePos()) { nkSoldierInfo2 = nkSoldierInfo; } } } } if (nkSoldierInfo2 == null && nkSoldierInfo3 == null) { this.nSelectedBattelPos = -1; uIRadioBtn.Value = false; this.BattlePosSelectedPos.Visible = false; return; } if (nkSoldierInfo2 != null) { battlePos = nkSoldierInfo2.GetBattlePos(); nkSoldierInfo2.SetBattlePos(num2); } if (nkSoldierInfo3 != null) { battlePos2 = nkSoldierInfo3.GetBattlePos(); nkSoldierInfo3.SetBattlePos(this.nSelectedBattelPos); } if (!this.IsValidChangeBattlePos()) { if (nkSoldierInfo2 != null) { nkSoldierInfo2.SetBattlePos(battlePos); } if (nkSoldierInfo3 != null) { nkSoldierInfo3.SetBattlePos(battlePos2); } } this.ShowBattlePosInfo(); this.nSelectedBattelPos = -1; uIRadioBtn.Value = false; this.BattlePosSelectedPos.Visible = false; }