示例#1
0
 public void MarkerTracked(Marker marker)
 {
     if (marker.Type == Marker.MarkerType.MainBase)
     {
         mainBase = marker;
     }
     else
     {
         if (matchs.Count > 0)
         {
             foreach (var m in matchs)
             {
                 if (m.isLackMarker())
                 {
                     m.Set(marker);
                     DPanel.Add(this, string.Format("New marker type <color=yellow>[{0}]</color> was <color=red>replace</color>", marker.Type));
                     return;
                 }
             }
         }
         matchs.Add(new MatchMarkersUnits(marker));
         DPanel.Add(this, string.Format("New marker type <color=yellow>[{0}]</color> was <color=green>added</color>", marker.Type));
     }
     //DPanel.Add(this, string.Format("New marker type <color=yellow>[{0}]</color> was <color=red>ADDED</color> to array with ID <color=blue>[{1}]</color>", marker.Type, marker.ID));
 }
示例#2
0
    public void SpawnNewUnit()
    {
        if (unitPrefab == null)
        {
            return;
        }
        var MB = MarkersManager.inst.GetMainBase();

        if (MB == null)
        {
            return;
        }
        if (GamePlayMenuHandler.inst.GetCurStage(MenuUICanvas.inst.GetStageCount()).SoldiersCount <= GamePlayMenuHandler.inst.SoldierAlive)
        {
            return;
        }
        if (MarkersManager.inst.CanCreateNewSoldier())
        {
            var u = Instantiate(unitPrefab, MB.position, MB.rotation, transform).GetComponent <Unit>();
            GamePlayMenuHandler.inst.SetSoldiersCount(++GamePlayMenuHandler.inst.SoldierAlive);
            if (u == null)
            {
                Destroy(u);
                return;
            }
            MarkersManager.inst.AddNewUnit(u);
        }
        else
        {
            DPanel.Add(this, "New UNIT <color=red>can't be created</color>");
        }
    }
示例#3
0
    public virtual void Die()
    {
        isLive = false;
        switch (parent.Type)
        {
        case Unit.UnitType.Zombie:
        {
            MarkersManager.inst.RemoweEnemy(parent);
            break;
        }

        case Unit.UnitType.Soldier:
        {
            MarkersManager.inst.RemoweUnit(parent);
            break;
        }

        case Unit.UnitType.Base:
        {
            DPanel.Add(this, "<color=red>PLAYER LOSE</color>");
            DPanel.Add(this, "<color=red>PLAYER LOSE</color>");
            DPanel.Add(this, "<color=red>PLAYER LOSE</color>");
            break;
        }
        }

        Destroy(parent.gameObject, 2f);
    }
示例#4
0
        private void JBtn_Click(object sender, EventArgs e)
        {
            DPanel.CreateGraphics().Clear(Color.White);
            Bitmap b = new Bitmap(DPanel.Width, DPanel.Height);

            if (BresenhamRadioButton.Checked)
            {
                if (EllipseRadioButton.Checked)
                {
                    DPanel.CreateGraphics().DrawImage(GraphicsClass.Fill_Bresenham_Ellipse(b, Pens.Red, (int)X0Y0Value.Value, (int)X0Y0Value.Value, (int)WidthValue.Value, (int)HeightValue.Value), 0, 0);
                }
                else
                {
                    DPanel.CreateGraphics().DrawImage(GraphicsClass.Fill_Bresenham_Pie(b, Pens.Red, (int)X0Y0Value.Value, (int)X0Y0Value.Value, (int)WidthValue.Value, (int)HeightValue.Value, (int)StartAngleValue.Value, (int)SweepAngleValue.Value), 0, 0);
                }
            }
            else
            {
                if (EllipseRadioButton.Checked)
                {
                    DPanel.CreateGraphics().DrawImage(GraphicsClass.Fill_Wu_Ellipse(b, Pens.Red, (int)X0Y0Value.Value, (int)X0Y0Value.Value, (int)WidthValue.Value, (int)HeightValue.Value), 0, 0);
                }
                else
                {
                    DPanel.CreateGraphics().DrawImage(GraphicsClass.Fill_Wu_Pie(b, Pens.Red, (int)X0Y0Value.Value, (int)X0Y0Value.Value, (int)WidthValue.Value, (int)HeightValue.Value, (int)StartAngleValue.Value, (int)SweepAngleValue.Value), 0, 0);
                }
            }
        }
示例#5
0
 public virtual void GetDamage(IAttack enemy)
 {
     CurrentHealth -= (enemy.AttackDamage - Armor);
     if (parent.Type != Unit.UnitType.Base)
     {
         GamePlayMenuHandler.inst.UpdateHPBarForUnit(parent, CurrentHealth);
     }
     if (parent.Type != Unit.UnitType.Base)
     {
         GamePlayMenuHandler.inst.UpdateHPBarForTower(parent, CurrentHealth);
     }
     if (CurrentHealth < 0)
     {
         DPanel.Add(this, "Unit type <color=yellow>[" + parent.Type + "]</color> was <color=red>DIE</color>");
         if (parent.Type == Unit.UnitType.Zombie)
         {
             GamePlayMenuHandler.inst.SetEnemiesCount(++GamePlayMenuHandler.inst.EnemyKilled);
         }
         if (parent.Type == Unit.UnitType.Soldier)
         {
             GamePlayMenuHandler.inst.SetSoldiersCount(--GamePlayMenuHandler.inst.SoldierAlive);
         }
         Die();
         return;
     }
     if (parent != null && parent.AttackController != null)
     {
         parent.AttackController.UnderAttack(enemy);
     }
 }
示例#6
0
        // Controler Logic
        private void Initialize()
        {
            _btnInstallInterface        = new DPanelButton();
            _btnInstallInterface.Text   = "Install Interface";
            _btnInstallInterface.Image  = Properties.Resources.install;
            _btnInstallInterface.Click += new EventHandler(_btnInstallInterface_Click);

            _btnUninstallInterface        = new DPanelButton();
            _btnUninstallInterface.Text   = "Uninstall Interface";
            _btnUninstallInterface.Image  = Properties.Resources.delete;
            _btnUninstallInterface.Click += new EventHandler(_btnUninstallInterface_Click);

            _btnStartInterface        = new DPanelButton();
            _btnStartInterface.Text   = "Start Interface";
            _btnStartInterface.Image  = Properties.Resources.start;
            _btnStartInterface.Click += new EventHandler(_btnStartInterface_Click);

            _btnStopInterface        = new DPanelButton();
            _btnStopInterface.Text   = "Stop Interface";
            _btnStopInterface.Image  = Properties.Resources.stop;
            _btnStopInterface.Click += new EventHandler(_btnStopInterface_Click);

            _btnMonitorInterface        = new DPanelButton();
            _btnMonitorInterface.Text   = "Monitor Interface";
            _btnMonitorInterface.Image  = Properties.Resources.monitor;
            _btnMonitorInterface.Click += new EventHandler(_btnMonitorInterface_Click);

            _btnConfigInterface        = new DPanelButton();
            _btnConfigInterface.Text   = "Configure Interface";
            _btnConfigInterface.Image  = Properties.Resources.config;
            _btnConfigInterface.Click += new EventHandler(_btnConfigInterface_Click);

            _btnExportConfig        = new DPanelButton();
            _btnExportConfig.Text   = "Export Configuration";
            _btnExportConfig.Image  = Properties.Resources.export;
            _btnExportConfig.Click += new EventHandler(_btnExportConfig_Click);

            _btnImportConfig        = new DPanelButton();
            _btnImportConfig.Text   = "Import Configuration";
            _btnImportConfig.Image  = Properties.Resources.import;
            _btnImportConfig.Click += new EventHandler(_btnImportConfig_Click);

            _interfacePanel = new DPanel(new DPanelButton[] {
                _btnInstallInterface,
                _btnUninstallInterface,
                _btnStartInterface,
                _btnStopInterface,
                _btnMonitorInterface,
                _btnConfigInterface,
                _btnImportConfig,
                _btnExportConfig,
            });
            _interfacePanel.Title.BackColor = Color.DarkGray;
            _interfacePanel.Title.Text      = "Interfaces Management";

            _viewPanel.OnPageRefresh       += new EventHandler(_viewPanel_OnPageRefresh);
            _interfaceView.SelectionChange += new EventHandler(_interfaceView_SelectionChange);
        }
示例#7
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (OpenFD.ShowDialog() == DialogResult.OK)
     {
         TheGraph = Graph.FileToGraph(File.ReadAllLines(OpenFD.FileName));
         TheGraph.GetColors();
         DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0));
     }
 }
示例#8
0
 public void AddNewUnit(Unit unit)
 {
     if (CanCreateNewSoldier())
     {
         unit.Target = GetFreeMarker(unit).MarkerPosition;
         units.Add(unit);
         DPanel.Add(this, string.Format("New UNIT type <color=yellow>[{0}]</color> was <color=red>ADDED</color> to array with ID <color=blue>[{1}]</color>", unit.Type, unit.ID));
     }
 }
示例#9
0
 public void RemoweUnit(Unit unit)
 {
     units.Remove(unit);
     if (matchs.Count > 0)
     {
         foreach (var m in matchs)
         {
             m.Remove(unit);
         }
     }
     DPanel.Add(this, string.Format("UNIT type <color=yellow>[{0}]</color> was <color=red>REMOWED</color> from array with ID <color=blue>[{1}]</color>", unit.Type, unit.ID));
 }
示例#10
0
 public void OnTrackableStateChanged(TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus)
 {
     if (newStatus == TrackableBehaviour.Status.TRACKED)
     {
         MarkersManager.inst.MarkerTracked(this);
         istracked = true;
         DPanel.Add(this, string.Format("<color=green>Find</color> marker type <color=yellow>[{0}]</color> with ID<color=blue>[{1}]</color>", Type, ID));
     }
     else
     {
         istracked = false;
         MarkersManager.inst.MarkerLost(this);
         DPanel.Add(this, string.Format("<color=red>Lost</color> marker type <color=yellow>[{0}]</color> with ID<color=blue>[{1}]</color>", Type, ID));
     }
 }
示例#11
0
 IEnumerator DoAttack()
 {
     while (target != null && target.isLive)
     {
         isCoroutineStart = true;
         target.GetDamage(this);
         parent.transform.LookAt(new Vector3((target.transform.position.x), 0, (target.transform.position.z)));
         DPanel.Add(this, string.Format("Unit <color=yellow>{0}</color> attacks unit <color=red>{1}</color>", parent.Type, target.parent.Type));
         yield return(new WaitForSeconds(TimeBeforeAttacks));
     }
     if (parent.Type == Unit.UnitType.Zombie)
     {
         parent.MoveController.Target = MarkersManager.inst.mainBase.MarkerPosition;
     }
     isAttack         = false;
     isCoroutineStart = false;
     StopCoroutine(DoAttack());
 }
示例#12
0
        private void Form1_Load(object sender, EventArgs e)
        {
            DPanelTitle pt = new DPanelTitle();

            pt.BackColor = Color.DarkGray;
            pt.Text      = "Devices";

            DPanelButton btn = new DPanelButton();

            btn.Image = Properties.Resources.blueball;
            btn.Text  = "Add Device";

            DPanel pnl = new DPanel(pt, new DPanelButton[] { btn });

            //---------------------

            DPanelTitle pt2 = new DPanelTitle();

            pt2.BackColor = Color.DarkGray;
            pt2.Text      = "Interfaces";

            DPanelButton btn21 = new DPanelButton();

            btn21.Image = Properties.Resources.blueball;
            btn21.Text  = "Install Interface";
            DPanelButton btn22 = new DPanelButton();

            btn22.Image = Properties.Resources.blueball;
            btn22.Text  = "Uninstall Interface";

            DPanel pnl2 = new DPanel(pt2, new DPanelButton[] { btn21, btn22 });

            pnl2.Collapse();

            //---------------------

            DPanelContainer pc = new DPanelContainer(new DPanel[] { pnl, pnl2 });

            pc.Dock = DockStyle.Fill;

            this.panel1.Controls.Add(pc);
        }
示例#13
0
        // Controler Logic
        private void Initialize()
        {
            _btnAddDevice        = new DPanelButton();
            _btnAddDevice.Text   = "Add Device";
            _btnAddDevice.Image  = Properties.Resources.install;
            _btnAddDevice.Click += new EventHandler(_btnAddDevice_Click);

            _btnDeleteDevice        = new DPanelButton();
            _btnDeleteDevice.Text   = "Delete Device";
            _btnDeleteDevice.Image  = Properties.Resources.delete;
            _btnDeleteDevice.Click += new EventHandler(_btnDeleteDevice_Click);

            _devicePanel = new DPanel(new DPanelButton[] {
                _btnAddDevice, _btnDeleteDevice
            });
            _devicePanel.Title.BackColor = Color.DarkGray;
            _devicePanel.Title.Text      = "Devices Management";

            _viewPanel.OnPageRefresh    += new EventHandler(_viewPanel_OnPageRefresh);
            _deviceView.SelectionChange += new EventHandler(_deviceView_SelectionChange);
        }
示例#14
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     TheGraph.VList = new List <Vert>();
     DPanel.CreateGraphics().Clear(Color.White);
 }
示例#15
0
 public void AddNewEnemy(Unit unit)
 {
     unit.Target = mainBase.MarkerPosition;
     enemys.Add(unit);
     DPanel.Add(this, string.Format("New UNIT type <color=yellow>[{0}]</color> was <color=red>ADDED</color> to array with ID <color=blue>[{1}]</color>", unit.Type, unit.ID));
 }
示例#16
0
 // Called when the virtual button has just been pressed:
 public void OnButtonPressed(VirtualButtonBehaviour vb)
 {
     DPanel.Add(this, string.Format("Virtual button was <color=red>click</color> with name <color=blue>[]</color>", vb.name));
     spawner.SpawnNewUnit();
 }
示例#17
0
 public void OnButtonReleased(VirtualButtonBehaviour vb)
 {
     Debug.Log("OnButtonReleased");
     DPanel.Add(this, string.Format("Virtual button was <color=red>released</color> with name <color=blue>[]</color>", vb.name));
 }
示例#18
0
        private void MagicClick(object sender, MouseEventArgs mouse)
        {
            if (AddVertRadio.Checked)
            {
                TheGraph.AddV(mouse.X, mouse.Y);
                DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0));
            }
            else

            if (AddEdgeRadio.Checked)
            {
                if (A == null)
                {
                    A = TheGraph.OnClick(mouse.X, mouse.Y);
                    if (A != null)
                    {
                        InfoLabel.Text = "Choose 2'nd vert";
                    }
                    else
                    {
                        InfoLabel.Text = "...";
                    }
                }
                else if (B == null)
                {
                    B = TheGraph.OnClick(mouse.X, mouse.Y);
                    if (B != null)
                    {
                        TheGraph.AddE(A, B);
                        DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0));
                        InfoLabel.Text = "Operation complete";
                    }
                    else
                    {
                        InfoLabel.Text = "...";
                    }
                    A = B = null;
                }
            }
            else

            if (DelEdgeRadio.Checked)
            {
                if (A == null)
                {
                    A = TheGraph.OnClick(mouse.X, mouse.Y);
                    if (A != null)
                    {
                        InfoLabel.Text = "Choose 2'nd vert";
                    }
                    else
                    {
                        InfoLabel.Text = "...";
                    }
                }
                else
                if (B == null)
                {
                    B = TheGraph.OnClick(mouse.X, mouse.Y);
                    if (B != null)
                    {
                        TheGraph.DelEdge(A, B);
                        DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0));
                        InfoLabel.Text = "Operation complete";
                    }
                    else
                    {
                        InfoLabel.Text = "...";
                    }
                    A = B = null;
                }
            }
            else

            if (DelVertRadio.Checked)
            {
                A = TheGraph.OnClick(mouse.X, mouse.Y);
                if (A != null)
                {
                    TheGraph.DelVert(A);
                    DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0));
                    A = null;
                    InfoLabel.Text = "Operation complete";
                }
                else
                {
                    InfoLabel.Text = "Wrong input";
                }
            }
            else

            if (MoveModeRadio.Checked)
            {
                if (A == null)
                {
                    A = TheGraph.OnClick(mouse.X, mouse.Y);
                    if (A != null)
                    {
                        InfoLabel.Text = "Point new location";
                    }
                    else
                    {
                        InfoLabel.Text = "Wrong input";
                    }
                }
                else if (A != null)
                {
                    A.vpoint.X = mouse.X; A.vpoint.Y = mouse.Y;
                    DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0));
                    A = null;
                    InfoLabel.Text = "Operation complete";
                }
            }
        }
示例#19
0
 private void SolutionButton_Click(object sender, EventArgs e)
 {
     TheGraph.SetBrushes();
     DPanel.CreateGraphics().DrawImage(TheGraph.DrawGraph(DPanel.Width, DPanel.Height), new Point(0, 0));
 }