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);
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    public bool IsEnablePos(NrCharKindInfo pkCharKindInfo, short nGridPos, BATTLE_POS_GRID battle_Grid)
    {
        if (nGridPos < 0)
        {
            return(false);
        }
        byte battleSizeX = pkCharKindInfo.GetBattleSizeX();
        byte battleSizeY = pkCharKindInfo.GetBattleSizeY();
        int  num         = (int)nGridPos % battle_Grid.m_nWidthCount;
        int  num2        = (int)nGridPos / battle_Grid.m_nWidthCount;

        if (num + (int)battleSizeX > battle_Grid.m_nWidthCount)
        {
            return(false);
        }
        if (num2 + (int)battleSizeY > battle_Grid.m_nHeightCount)
        {
            return(false);
        }
        for (int i = 0; i < (int)battleSizeY; i++)
        {
            for (int j = 0; j < (int)battleSizeX; j++)
            {
                int num3 = num + j + (num2 + i) * battle_Grid.m_nWidthCount;
                if (num3 < 0 || num3 >= battle_Grid.m_nHeightCount * battle_Grid.m_nWidthCount)
                {
                    return(false);
                }
                if (battle_Grid.m_veBUID[num3] >= 0)
                {
                    return(false);
                }
                if (!battle_Grid.m_vebActive[num3])
                {
                    return(false);
                }
            }
        }
        return(true);
    }
    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);
    }