Example #1
0
 /// <summary>
 /// Raises event 'ChangeMenu'
 /// </summary>
 protected virtual void OnChangeMenu()
 {
     if (ChangeMenu != null)
     {
         ChangeMenu.Invoke(this, System.EventArgs.Empty);
     }
 }
Example #2
0
 private void Awake()
 {
     Time.timeScale = 1f;
     SetHealth();
     HealthText   = GameObject.FindGameObjectWithTag("HealthText").GetComponent <Text>();
     EventManager = GameObject.FindGameObjectWithTag("EventManager");
     changeMenu   = EventManager.GetComponent <ChangeMenu>();
 }
Example #3
0
        public BattleMenu(Ally a, Menu.ScreenState screenState)
            : base(screenState.Width / 4,
                screenState.Height * 7 / 10 + 10,
                screenState.Width / 5,
                screenState.Height * 5 / 20 - 6)
        {
            AssociatedAlly = a;

            xs = screenState.Width / 5;

            Visible = false;

            ChangeMenuInstance = new ChangeMenu(this, screenState);

            // Always an option

            #region Item Menu

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "W-Item")
                {
                    _witem = true;
                }
            }

            #endregion Item Menu

            // iterate through options
            int o = 0;

            #region Attack

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null)
                {
                    if (m.Name == "Double Cut")
                    {
                        if (m.Level == 0)
                        {
                            _doubleCutOption2 = o;
                            _doubleCutOption4 = -1;
                        }
                        else
                        {
                            _doubleCutOption4 = o;
                            _doubleCutOption2 = -1;
                        }
                        _slashAllOption = -1;
                        _flashOption = -1;
                    }
                    else if (m.Name == "Slash-All")
                    {
                        if (m.Level == 0)
                        {
                            _slashAllOption = o;
                            _flashOption = -1;
                        }
                        else
                        {
                            _flashOption = o;
                            _slashAllOption = -1;
                        }
                        _doubleCutOption2 = -1;
                        _doubleCutOption4 = -1;
                    }
                }
            }
            if (_doubleCutOption2 == -1 && _doubleCutOption4 == -1 &&
                _slashAllOption == -1 && _flashOption == -1)
            {
                _attackOption = o;
            }
            o++;

            #endregion Attack

            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }

            #region Magic Menu
            int c = 0;
            foreach (MagicMenuEntry s in a.MagicSpells)
            {
                c++;
            }
            if (c > 0)
            {
                _magicMenuOption = o;
                o++;
                foreach (MateriaOrb m in a.Materia)
                {
                    if (m != null && m.Name == "W-Magic")
                    {
                        _wmagic = true;
                    }
                }
            }

            #endregion Magic Menu

            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }

            #region Summon Menu
            c = 0;

            foreach (SummonMenuEntry s in a.Summons)
            {
                c++;
            }

            if (c > 0)
            {
                _summonMenuOption = o;
                o++;
                foreach (MateriaOrb m in a.Materia)
                {
                    if (m != null && m.Name == "W-Summon")
                    {
                        _wsummon = true;
                    }
                }
            }
            #endregion Summon Menu

            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }

            #region Sense

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Sense")
                {
                    _senseOption = o;
                    o++;
                }
            }

            #endregion

            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }

            #region Enemy Skill

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Enemy Skill")
                {
                    if (_enemySkillMenuOption < 0)
                    {
                        _enemySkillMenuOption = o;
                        o++;
                    }
                }
            }
            #endregion

            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }

            #region Mime

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Mime")
                {
                    _mimeOption = o;
                    o++;
                    break;
                }
            }

            #endregion

            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }

            #region Deathblow

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Deathblow")
                {
                    _deathblowOption = o;
                    o++;
                    break;
                }
            }
            #endregion

            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }

            #region Steal

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Steal")
                {
                    if (m.Level == 0)
                    {
                        _stealOption = o;
                        _mugOption = -1;
                    }
                    else
                    {
                        _mugOption = o;
                        _stealOption = -1;
                    }
                }
            }
            if (_mugOption != -1 || _stealOption != -1)
            {
                o++;
            }

            #endregion

            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }

            _columns = (o - 1) / _rows + 1;
            if (_columns != 1)
            {
                Width = W * _columns;
            }
        }
Example #4
0
        public BattleMenu(Ally a, Menu.ScreenState screenState)
            : base(
                screenState.Width / 4,
                screenState.Height * 7 / 10 + 10,
                screenState.Width / 5,
                screenState.Height * 5 / 20 - 6)
        {
            AssociatedAlly = a;

            xs = screenState.Width / 5;

            Visible = false;

            ChangeMenuInstance = new ChangeMenu(this, screenState);


            // Always an option

            #region Item Menu

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "W-Item")
                {
                    _witem = true;
                }
            }

            #endregion Item Menu



            // iterate through options
            int o = 0;

            #region Attack

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null)
                {
                    if (m.Name == "Double Cut")
                    {
                        if (m.Level == 0)
                        {
                            _doubleCutOption2 = o;
                            _doubleCutOption4 = -1;
                        }
                        else
                        {
                            _doubleCutOption4 = o;
                            _doubleCutOption2 = -1;
                        }
                        _slashAllOption = -1;
                        _flashOption    = -1;
                    }
                    else if (m.Name == "Slash-All")
                    {
                        if (m.Level == 0)
                        {
                            _slashAllOption = o;
                            _flashOption    = -1;
                        }
                        else
                        {
                            _flashOption    = o;
                            _slashAllOption = -1;
                        }
                        _doubleCutOption2 = -1;
                        _doubleCutOption4 = -1;
                    }
                }
            }
            if (_doubleCutOption2 == -1 && _doubleCutOption4 == -1 &&
                _slashAllOption == -1 && _flashOption == -1)
            {
                _attackOption = o;
            }
            o++;

            #endregion Attack



            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }



            #region Magic Menu
            int c = 0;
            foreach (MagicMenuEntry s in a.MagicSpells)
            {
                c++;
            }
            if (c > 0)
            {
                _magicMenuOption = o;
                o++;
                foreach (MateriaOrb m in a.Materia)
                {
                    if (m != null && m.Name == "W-Magic")
                    {
                        _wmagic = true;
                    }
                }
            }

            #endregion Magic Menu



            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }



            #region Summon Menu
            c = 0;

            foreach (SummonMenuEntry s in a.Summons)
            {
                c++;
            }

            if (c > 0)
            {
                _summonMenuOption = o;
                o++;
                foreach (MateriaOrb m in a.Materia)
                {
                    if (m != null && m.Name == "W-Summon")
                    {
                        _wsummon = true;
                    }
                }
            }
            #endregion Summon Menu



            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }



            #region Sense

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Sense")
                {
                    _senseOption = o;
                    o++;
                }
            }

            #endregion



            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }



            #region Enemy Skill

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Enemy Skill")
                {
                    if (_enemySkillMenuOption < 0)
                    {
                        _enemySkillMenuOption = o;
                        o++;
                    }
                }
            }
            #endregion



            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }



            #region Mime

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Mime")
                {
                    _mimeOption = o;
                    o++;
                    break;
                }
            }

            #endregion



            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }



            #region Deathblow

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Deathblow")
                {
                    _deathblowOption = o;
                    o++;
                    break;
                }
            }
            #endregion



            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }



            #region Steal

            foreach (MateriaOrb m in a.Materia)
            {
                if (m != null && m.Name == "Steal")
                {
                    if (m.Level == 0)
                    {
                        _stealOption = o;
                        _mugOption   = -1;
                    }
                    else
                    {
                        _mugOption   = o;
                        _stealOption = -1;
                    }
                }
            }
            if (_mugOption != -1 || _stealOption != -1)
            {
                o++;
            }

            #endregion



            // put this after every one in order to skip the Item option
            if (o == 3)
            {
                o++;
            }



            _columns = (o - 1) / _rows + 1;
            if (_columns != 1)
            {
                Width = W * _columns;
            }
        }
Example #5
0
        public async Task OnKeyUp(KeyboardEventArgs e)
        {
            string value = e.Key.ToLower();

            if (value == "delete" || value == "backspace")
            {
                await DeleteActive.InvokeAsync("all");
            }
            if (e.CtrlKey)
            {
                if (e.ShiftKey)
                {
                    if (value == "i")
                    {
                        await Activate("nodes");
                    }
                    else if (value == "e")
                    {
                        await Activate("edges");
                    }
                    else if (value == "s")
                    {
                        await SaveAsSVG();
                    }
                }
                else
                {
                    if (value == "c")
                    {
                        Copy();
                    }
                    else if (value == "a")
                    {
                        await Activate("all");
                    }
                }
            }
            else
            {
                if (value == "f")
                {
                    await ChangeMenu.InvokeAsync(NavChoice.File);
                }
                else if (value == "h")
                {
                    await ChangeMenu.InvokeAsync(NavChoice.Home);
                }
                else if (value == "i")
                {
                    await ChangeMenu.InvokeAsync(NavChoice.Insert);
                }
                else if (value == "v")
                {
                    await ChangeMenu.InvokeAsync(NavChoice.View);
                }
                else if (value == "d")
                {
                    await ChangeMenu.InvokeAsync(NavChoice.Design);
                }
                else if (value == "?")
                {
                    await ChangeMenu.InvokeAsync(NavChoice.About);
                }
                else if (value == "x")
                {
                    await ChangeMenu.InvokeAsync(null);
                }
                else if (ActiveGraph.Nodes.Count == 2 && !ActiveGraph.Edges.Any() && value == "c")
                {
                    NewEdge.Tail       = ActiveGraph.Nodes[0];
                    NewEdge.Head       = ActiveGraph.Nodes[1];
                    NewEdge.MultiEdges = EdgeService.MultiGraphEdges(Graph.Edges, NewEdge.Head, NewEdge.Tail, Graph.Directed);
                    if (Graph.Weighted)
                    {
                        NewEdge.GetEdgeWeight = true;
                    }
                    else if (!NewEdge.MultiEdges.Any())
                    {
                        await AddNewEdge(true);
                    }
                }
            }
        }
Example #6
0
        public async Task Select(MenuEventArgs <MenuItem> e)
        {
            switch (e.Item.Text)
            {
            case "Copy":
                Copy();
                break;

            case "Paste":
                await Paste();

                break;

            case "Left":
            case "Center":
            case "Right":
            case "Top":
            case "Middle":
            case "Bottom":
                NodeService.Align(ActiveGraph.Nodes, e.Item.Text);
                break;

            case "Delete":
                await DeleteActive.InvokeAsync("all");

                break;

            case "Edit":
            case "Nodes":
            case "Edges":
                await ChangeMenu.InvokeAsync(NavChoice.Design);

                break;

            case "All Nodes":
                await Activate("nodes");

                break;

            case "All Edges":
                await Activate("edges");

                break;

            case "Everything":
                await Activate("all");

                break;

            case "Insert Edge":
                await InsertEdge();

                break;

            case "Insert Node":
                NodeService.AddNode(Graph.Nodes, Options.Default, origin[0] * SVGControl.Scale + SVGControl.Xaxis, origin[1] * SVGControl.Scale + SVGControl.Yaxis);
                await GraphChanged.InvokeAsync(Graph);

                break;

            case "Stop Algorithm":
                if (StartAlgorithm.Done)
                {
                    StartAlgorithm.Clear = true;
                }
                else
                {
                    await Reset();
                }
                break;

            case "Zoom In":
                if (ZoomService.ZoomIn(SVGControl))
                {
                    await SVGControlChanged.InvokeAsync(SVGControl);
                }
                break;

            case "Zoom Out":
                if (ZoomService.ZoomOut(SVGControl))
                {
                    await SVGControlChanged.InvokeAsync(SVGControl);
                }
                break;
            }
        }