コード例 #1
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            if (!CheckData())
            {
                return;
            }
            if (!chbox_position.Checked && !chbox_wall.Checked)
            {
                MessageBox.Show("Please, Enable at least one options...");
                return;
            }
            DefPos DF = EditablePosition;

            if (DF == null)
            {
                DF = PrimalSimulator.DefenceManager.CreateDefPos(Side);
            }
            DF.SetPositionStats((int)num_pos_W.Value, (int)num_pos_H.Value, (int)num_pos_T.Value, (int)num_pos_D.Value);
            DF.SetWallStats((int)num_wall_W.Value, (int)num_wall_H.Value, (int)num_wall_T.Value, (int)num_wall_D.Value);
            DF.DefPosName    = txt_name.Text;
            EditablePosition = DF;
            if (DF != null)
            {
                if (!DF.CheckCapacity())
                {
                    MessageBox.Show("Out of capacity!");
                    return;
                }
            }
            //MessageBox.Show("Object was create or edit!");
            this.Close();
        }
コード例 #2
0
 public void Init()
 {
     tb_pos_D.Scroll    += ChangeTextAuto;
     tb_wall_D.Scroll   += ChangeTextAuto;
     num_pos_D.ReadOnly  = true;
     num_wall_D.ReadOnly = true;
     EditablePosition    = null;
 }
コード例 #3
0
 public void RemoveItem(DefPos D)
 {
     if (AllyDefPosts.Contains(D))
     {
         AllyDefPosts.Remove(D);
     }
     if (EnemyDefPosts.Contains(D))
     {
         EnemyDefPosts.Remove(D);
     }
     D.UnloadAllUnits();
     ConsoleBox.WriteLineToConsole("Item " + D.ToString() + " removed...");
 }
コード例 #4
0
        private void btn_addpos_Click(object sender, EventArgs e)
        {
            AddDefPosForm addDefPosForm = new AddDefPosForm(PrimalManager, Side);

            addDefPosForm.Show();
            addDefPosForm.FormClosed += (senderr, ee) => {
                if (PrimalManager.tempDefPos != null)
                {
                    SelectDefPos             = PrimalManager.tempDefPos;
                    l_position.Text          = SelectDefPos.ToShortString();
                    l_leader.Text            = SelectDefPos.getLeader();
                    PrimalManager.tempDefPos = null;
                }
            };
        }
コード例 #5
0
        private void a_btn_edit_defpos_Click(object sender, EventArgs e)
        {
            DefPos D = (DefPos)PrimalManager.DefenceBoxA.SelectedItem;

            if (D == null)
            {
                return;
            }
            DefencePostionForm defencePostionForm = new DefencePostionForm(PrimalManager, TypesEnums.UnitSide.Ally, D);

            defencePostionForm.Show();
            defencePostionForm.FormClosed += (senderr, ee) => {
                refreshBoxes();
            };
        }
コード例 #6
0
        public DefPos CreateDefPos(TypesEnums.UnitSide S)
        {
            DefPos D = new DefPos(NextID);

            if (S == TypesEnums.UnitSide.Ally)
            {
                AllyDefPosts.Add(D);
                ConsoleBox.WriteLineToConsole("New ALLY DefencePosition CREATE!");
            }
            else
            {
                EnemyDefPosts.Add(D);
                ConsoleBox.WriteLineToConsole("New ENEMY DefencePosition CREATE!");
            }
            return(D);
        }
コード例 #7
0
 public UnitsForm(SimulatorManager SM, TypesEnums.UnitSide S, IUnit U)
 {
     InitializeComponent();
     PrimalSimulator = SM;
     Side            = S;
     Type            = (TypesEnums.UnitType)U.UnitType;
     Init();
     EditableUnit = U;
     SelectDefPos = U.MyDefPosition;
     if (SelectDefPos != null)
     {
         l_position.Text    = SelectDefPos.ToShortString();
         l_leader.Text      = SelectDefPos.getLeader();
         chbox_hold.Checked = true;
     }
     txt_name.Text = U.UnitName;
     PrimalSimulator.ConsoleBox.WriteLineToConsole("UnitForm READY! Mode: EDIT");
     btn_ok.Text = "Edit unit";
 }
コード例 #8
0
        public DefencePostionForm(SimulatorManager SM, TypesEnums.UnitSide S, DefPos D)
        {
            InitializeComponent();
            PrimalSimulator = SM;
            Side            = S;

            num_pos_W.Value = D.WeightPosition;
            num_pos_H.Value = D.HeightPosition;
            num_pos_T.Value = D.TallPosition;
            num_pos_D.Value = D.DefencePosition;

            num_wall_W.Value = D.WeightWall;
            num_wall_H.Value = D.HeightWall;
            num_wall_T.Value = D.TallWall;
            num_wall_D.Value = D.DefenceWall;

            txt_name.Text = D.DefPosName;

            Init();
            btn_OK.Text      = "Edit";
            EditablePosition = D;
            PrimalSimulator.ConsoleBox.WriteLineToConsole("DefencePositionForm : EDIT MODE");
        }