Ejemplo n.º 1
0
 public static void Register(ActionMenu _actionMenu)
 {
     if (_actionMenu != null && !m_ActionMenu.ContainsKey(_actionMenu.name))
     {
         m_ActionMenu.Add(_actionMenu.name, _actionMenu);
     }
 }
Ejemplo n.º 2
0
    void Trade()
    {
        Item fromUnit   = null;
        Item fromTarget = null;

        foreach (ItemButton b in inv1.GetComponentsInChildren <ItemButton>())
        {
            if (b.GetComponent <UIHighlight>().IsStatic)
            {
                fromUnit = b.GetItem();
                break;
            }
        }

        foreach (ItemButton b in inv2.GetComponentsInChildren <ItemButton>())
        {
            if (b.GetComponent <UIHighlight>().IsStatic)
            {
                fromTarget = b.GetItem();
                break;
            }
        }

        if (fromUnit == null || fromTarget == null)
        {
            return;
        }

        Fighter.Unit.inventory.Trade(Fighter, Target, fromUnit, fromTarget);

        ActionMenu.BaseAction();
        ResetLists(Fighter, Target);
    }
Ejemplo n.º 3
0
 public void destroyActionMenu()
 {
     storedTooltipBounds = new Rect(0,0,0,0);
     storedTooltipText = null;
     storedActionMenu = null;
     actionMenuOpen = false;
 }
Ejemplo n.º 4
0
    public void CreateNewAsset()
    {
        var asset = ScriptableObject.CreateInstance <ActionAsset>();

        newNetworkName = newNetworkName.Replace(" ", string.Empty);

        string nameCopy = newNetworkName.Clone().ToString();

        int index = 0;

        if (System.IO.File.Exists(Application.dataPath + "/coAdjoint/Action/Libraries/" + newNetworkName + ".asset"))
        {
            ++index;

            while (System.IO.File.Exists(Application.dataPath + "/coAdjoint/Action/Libraries/" + newNetworkName + index + ".asset"))
            {
                ++index;
            }

            nameCopy += index.ToString();
        }

        asset.libraryData = (new ActionLibrary()).GetData();

        AssetDatabase.CreateAsset(asset, "Assets/coAdjoint/Action/Libraries/" + nameCopy + ".asset");

        Selection.activeObject = asset;

        ActionMenu.EditLibraryAsset();

        this.Close();
    }
Ejemplo n.º 5
0
 public static void Unregister(ActionMenu _actionMenu)
 {
     if (_actionMenu != null)
     {
         m_ActionMenu.Remove(_actionMenu.name);
     }
 }
Ejemplo n.º 6
0
 private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if ((e.ColumnIndex == Offset.Index) && (e.Value != null))
     {
         byte b = (byte)e.Value;
         e.Value             = b.ToString("X2");
         e.FormattingApplied = true;
     }
     else if (e.ColumnIndex == ActionColumn.Index)
     {
         if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0) &&
             (dataGridView[e.ColumnIndex, e.RowIndex] is DataGridViewComboBoxCell) &&
             (dataGridView.Rows[e.RowIndex].DataBoundItem is ActionMenu))
         {
             ActionMenu menu = dataGridView.Rows[e.RowIndex].DataBoundItem as ActionMenu;
             if (menu.Default != null)
             {
                 ActionMenuEntry a = menu.Default.MenuAction;
                 if (a != (e.Value as ActionMenuEntry))
                 {
                     e.CellStyle.BackColor = Settings.ModifiedColor.BackgroundColor;
                     e.CellStyle.ForeColor = Settings.ModifiedColor.ForegroundColor;
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
 private void Update()
 {
     if (IsOpen && InputManager.RightClickUp())
     {
         ActionMenu.Open(PhaseManager.Fighter);
         Close();
     }
 }
Ejemplo n.º 8
0
 public void updateCard(ObjectInfo info, ActionMenu menu)
 {
     actionInfo    = info;
     parentMenu    = menu;
     nameText.text = info.name;//todo: should find real name in item json
     //updateDetail();
     button.GetComponent <UIButton>().OnClick.OnTrigger.Event.AddListener(delegate { select(); });
 }
Ejemplo n.º 9
0
    void Update()
    {
        // Make sure you have the ActionMenu component
        if (actionMenu == null && GameObject.Find("Camera"))
            actionMenu = GameObject.Find("Camera").GetComponent<ActionMenu>();

        //  Return if action menu is not set
        if (actionMenu == null)
            return;

        // Move objects to correct position
        foreach (Types type in Enum.GetValues(typeof(Types)))
        {
            // Decide to make visible or invisible
            if (type != Types.Null && type == currentType)
            {
                sideObjects[(int)type].SetActive(true);
            }
            else if (type != Types.Null && type != currentType)
            {
                sideObjects[(int)type].SetActive(false);
            }

            // Check if this is the action menu. If yes, loop through his child objects
            if (type == Types.ActionMenu)
            {
                foreach (GameObject obj in actionMenuItems)
                {
                    // Enable/disable children
                    if (obj.name == actionMenu.currentAction.ToString())
                    {
                        for (int amount = 0; amount < obj.transform.childCount; amount++)
                        {
                            obj.transform.GetChild(amount).gameObject.SetActive(true);
                        }
                    }
                    else
                    {
                        for (int amount = 0; amount < obj.transform.childCount; amount++)
                        {
                            obj.transform.GetChild(amount).gameObject.SetActive(false);
                        }
                    }
                }
            }
        }

        // Loop through touches
        int i = 0;
        while (i < Input.touchCount)
        {
            // Check if input is to the right of the UI
            if (Input.GetTouch(i).position.x > 300 && Input.GetTouch(i).phase == TouchPhase.Ended)
                currentType = Types.Null;

            i++;
        }
    }
Ejemplo n.º 10
0
        public static void AddPedalsInList(List <PedalStruct> list, ActionMenu instance)
        {
            //if (!LoaderIntegrityCheck.passed && new System.Random().Next(3) == 1) return;
            foreach (var pedalStruct in list)
            {
                if (!pedalStruct.shouldAdd)
                {
                    continue;
                }
                var pedalOption = instance.AddOption();
                pedalOption.SetText(pedalStruct.text);
                if (!pedalStruct.locked)
                {
                    pedalOption.SetPedalAction(pedalStruct.triggerEvent);
                }
                else
                {
                    pedalOption.Lock();
                }
                //Additional setup for pedals
                switch (pedalStruct.Type)
                {
                /*case PedalType.SubMenu:
                 *  pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeFolder);
                 *  break;*/
                case PedalType.RadialPuppet:
                    var pedalRadial = (PedalRadial)pedalStruct;
                    pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeRadial);
                    pedalOption.SetButtonPercentText($"{Math.Round(pedalRadial.currentValue)}%");
                    pedalRadial.pedal = pedalOption;
                    pedalOption.SetBackgroundIcon(pedalStruct.icon);
                    break;

                case PedalType.Toggle:
                    var pedalToggle = (PedalToggle)pedalStruct;
                    if (pedalToggle.toggled)
                    {
                        pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeToggleOn);
                    }
                    else
                    {
                        pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeToggleOff);
                    }
                    pedalToggle.pedal = pedalOption;
                    pedalOption.SetBackgroundIcon(pedalStruct.icon);
                    break;

                case PedalType.FourAxisPuppet:
                    pedalOption.SetPedalTypeIcon(GetExpressionsIcons().typeAxis);
                    pedalOption.SetBackgroundIcon(pedalStruct.icon);
                    break;

                default:
                    pedalOption.SetForegroundIcon(pedalStruct.icon);
                    break;
                }
            }
        }
Ejemplo n.º 11
0
        public override void Callback(ActionMenu menu)
        {
            var actor = GameContext.Actors[actorIndex];

            GameContext.WalkTo(2, 1, 1, GameContext.Self.PathX[0], GameContext.Self.PathY[0], actor.PathX[0], actor.PathY[0], 0, 0, 0, false);

            var pos = InputUtils.mousePosition;

            GameContext.Cross.Show(2, (int)pos.x, (int)pos.y);

            switch (optionIndex)
            {
            case 0:
            {
                var @out = new Packet(155);
                @out.WriteLEShort(actorIndex);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 1:
            {
                var @out = new Packet(72);
                @out.WriteShortA(actorIndex);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 2:
            {
                var @out = new Packet(17);
                @out.WriteLEShortA(actorIndex);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 3:
            {
                var @out = new Packet(21);
                @out.WriteShort(actorIndex);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 4:
            {
                var @out = new Packet(18);
                @out.WriteLEShort(actorIndex);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 5:
                var desc = actor.Config;
                GameContext.Chat.Add(new ChatMessage(MessageType.Ambiguous, "", "It's a " + desc.Name + "."));
                break;
            }
        }
Ejemplo n.º 12
0
    public static void Show(string _menuName)
    {
        ActionMenu result = null;

        if (m_ActionMenu.TryGetValue(_menuName, out result) && !result.gameObject.activeSelf)
        {
            result.Show();
        }
    }
Ejemplo n.º 13
0
        /// <summary>
        /// Unselect one action menu and its childs.
        /// </summary>
        /// <param name="actionMenu">The action menu to unselect.</param>
        private void UnselectAction(ActionMenu actionMenu)
        {
            for (int index = 0; index < actionMenu.Commands.Count; index++)
            {
                actionMenu.Commands[index].Selected = false;
            }

            actionMenu.Selected = false;
        }
Ejemplo n.º 14
0
    private void showActionMenu()
    {
        actionMenu = MenuManager.instantiateActionMenu();

        addActionMenuListeners();
        actionMenu.init(currentPlayer);

        isMenuActive = true;
    }
Ejemplo n.º 15
0
        /// <summary>
        /// Called when the aim of the Heal magic is released.
        /// </summary>
        /// <param name="actionMenu">The menu that requested the mover.</param>
        /// <param name="target">The unit targeted by the aim. Null if the aim is over anything.</param>
        /// <param name="position">The last valid position of the aim.</param>
        private void Aim_Aimed(ActionMenu actionMenu, Unit target, Vector2 position)
        {
            this.Reset();

            // Execute the command.
            CommandMenu commandMenu = actionMenu as CommandMenu;

            commandMenu.Command.Execute(target, position);
        }
Ejemplo n.º 16
0
    public static void Hide(string _menuName)
    {
        ActionMenu result = null;

        if (!m_ActionMenu.TryGetValue(_menuName, out result) && result.gameObject.activeSelf)
        {
            result.Hide();
        }
    }
Ejemplo n.º 17
0
 private void pasteAll(object sender, EventArgs e)
 {
     if (copiedEntry != null)
     {
         ActionMenu destEntry = dataGridView.CurrentRow.DataBoundItem as ActionMenu;
         copiedEntry.CopyAllTo(destEntry);
         dataGridView.Invalidate();
     }
 }
Ejemplo n.º 18
0
    public override void OnInspectorGUI()
    {
        GUILayout.TextArea("This asset contains your Action Library. The library contains one or more" +
                           " networks for use in your Unity3D project. To edit the library, press the 'Edit Library' button below.");
        EditorGUILayout.Separator();

        ActionAsset highlightedAsset = Selection.activeObject as ActionAsset;

        try
        {
            currentLibrary = ActionLibrary.LoadData(highlightedAsset.libraryData);
        }
        catch {}

        GUILayout.Label("This library contains " + currentLibrary.networks.Length + " networks.");
        EditorGUILayout.Separator();

        GUILayout.BeginHorizontal();
        {
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Edit Library", GUILayout.MaxWidth(100f)))
            {
                ActionMenu.EditLibraryAsset();
            }
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10f);

        GUILayout.BeginHorizontal();
        {
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Generate Runtime Library from Asset"))
            {
                //ActionClassGenerator.CreateNetworkClass(Selection.activeObject as ActionAsset);
                ActionCompiler.GenerateRTLibrary(Selection.activeObject as ActionAsset);
            }
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();

        GUILayout.Space(10f);

        GUILayout.BeginHorizontal();
        {
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Export Library"))
            {
                SerializeToXML(currentLibrary);
                //SerializeToBin(currentLibrary);
            }
            GUILayout.FlexibleSpace();
        }
        GUILayout.EndHorizontal();
    }
Ejemplo n.º 19
0
 private static void AddPedalsInList(List <PedalStruct> pedalStructs, ActionMenu instance)
 {
     foreach (PedalStruct pedalStruct in pedalStructs)
     {
         PedalOption pedalOption = instance.AddOption();
         pedalOption.setText(pedalStruct.text); //    VVV
         pedalOption.setIcon(pedalStruct.icon); //Pretty self explanatory
         pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
     }
 }
Ejemplo n.º 20
0
        public override void Callback(ActionMenu menu)
        {
            switch (optionIndex)
            {
            case 0:
            {
                var @out = new Packet(145);
                @out.WriteShortA(widgetId);
                @out.WriteShortA(widgetSlot);
                @out.WriteShortA(itemId);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 1:
            {
                var @out = new Packet(117);
                @out.WriteLEShortA(widgetId);
                @out.WriteLEShortA(itemId);
                @out.WriteLEShort(widgetSlot);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 2:
            {
                var @out = new Packet(43);
                @out.WriteLEShort(widgetId);
                @out.WriteShortA(itemId);
                @out.WriteShortA(widgetSlot);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 3:
            {
                var @out = new Packet(129);
                @out.WriteShortA(widgetSlot);
                @out.WriteShort(widgetId);
                @out.WriteShortA(itemId);
                GameContext.NetworkHandler.Write(@out);
                break;
            }

            case 4:
            {
                var @out = new Packet(135);
                @out.WriteLEShort(widgetSlot);
                @out.WriteShortA(widgetId);
                @out.WriteLEShort(itemId);
                GameContext.NetworkHandler.Write(@out);
                break;
            }
            }
        }
Ejemplo n.º 21
0
        public static void AddPedalsInList(List <PedalStruct> list, ActionMenu instance)
        {
            foreach (var pedalStruct in list)
            {
                PedalOption pedalOption = instance.AddOption();
                switch (pedalStruct.Type)
                {
                case PedalType.Button:
                    pedalOption.setText(pedalStruct.text);
                    pedalOption.setIcon(pedalStruct.icon);
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;

                case PedalType.SubMenu:
                    pedalOption.setText(pedalStruct.text);
                    pedalOption.setIcon(pedalStruct.icon);
                    pedalOption.field_Public_ActionButton_0.prop_Texture2D_2          = GetExpressionsIcons().typeFolder;
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;

                case PedalType.RadialPuppet:
                    PedalRadial pedalRadial = (PedalRadial)pedalStruct;
                    pedalOption.setText(pedalStruct.text);
                    pedalOption.setIcon(pedalStruct.icon);
                    pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeRadial;
                    pedalOption.field_Public_ActionButton_0.prop_String_1    = $"{Math.Round(pedalRadial.currentValue)}%";
                    pedalRadial.pedal = pedalOption;
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;

                case PedalType.Toggle:
                    PedalToggle pedalToggle = (PedalToggle)pedalStruct;
                    pedalOption.setText(pedalStruct.text);
                    if (pedalToggle.toggled)
                    {
                        pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeToggleOn;
                    }
                    else
                    {
                        pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeToggleOff;
                    }
                    pedalOption.setIcon(pedalToggle.icon);
                    pedalToggle.pedal = pedalOption;
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;

                case PedalType.FourAxisPuppet:
                    pedalOption.setText(pedalStruct.text);
                    pedalOption.setIcon(pedalStruct.icon);
                    pedalOption.field_Public_ActionButton_0.prop_Texture2D_2          = GetExpressionsIcons().typeAxis;
                    pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent);
                    break;
                }
            }
        }
Ejemplo n.º 22
0
 public void Awake()
 {
     if(log == null)
     {
         GameObject c = GameObject.Find("Main Camera");
         log = c.GetComponentInChildren<Log>();
         actionMenu = c.GetComponent<ActionMenu>();
     }
     //		goalPoint = actionMenu.transform.position;
     //		goalPoint.y = transform.position.y;
 }
Ejemplo n.º 23
0
    System.Collections.IEnumerator _Close()
    {
        yield return(new WaitForSeconds(0.1f));

        IsOpen = false;

        if (!ActionMenu.instance.TradeThroughItemMenu)
        {
            ActionMenu.Open(PhaseManager.Fighter);
        }
    }
Ejemplo n.º 24
0
    public static void Close()
    {
        instance.ClearList();
        instance.menu.SetActive(false);

        IsOpen = false;

        ActionMenu.Open(PhaseManager.Fighter);

        Fighter = null;
    }
Ejemplo n.º 25
0
        private void PlaceShipsRandomly()
        {
            InitBoard.InitializeBoard(MyGame);
            ShipPlacement.RandomPlacement(MyGame, false);
            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseMySQL(
                "server=localhost;database=battleship;user=root;password=toor");
            Ctx = new AppDbContext(optionsBuilder.Options);
            Ctx.Add(MyGame);
            ActionMenu.BombingMenu(MyGame, Ctx);
        }
Ejemplo n.º 26
0
    public void Ini()
    {
        var action_menu_obj = GameObject.Find("ActionMenuList").GetComponentsInChildren <UnityEngine.UI.Dropdown>();

        for (var index = 0; index < action_menu_obj.Length; index++)
        {
            var action_menu = new ActionMenu();
            action_menu.Menu = action_menu_obj[index];
            action_menu_list.Add(action_menu);
            action_menu.Test();
        }
    }
Ejemplo n.º 27
0
    public void EndTurn()
    {
        if (Unit.alignment == Unit.Alignment.Player)
        {
            ActionMenu.Close();
        }

        TurnOver = true;
        mat.SetFloat("_EffectAmount", 1);

        UnitManager.OnUnitEnd(this);
    }
Ejemplo n.º 28
0
 private void Control_KeyDown(object sender, KeyEventArgs e)
 {
     if ((e.KeyData == Keys.F12) &&
         (dataGridView.CurrentCell is DataGridViewComboBoxCell) &&
         (dataGridView.CurrentRow.DataBoundItem is ActionMenu))
     {
         ActionMenu action = dataGridView.CurrentRow.DataBoundItem as ActionMenu;
         DataGridViewComboBoxEditingControl c = dataGridView.EditingControl as DataGridViewComboBoxEditingControl;
         c.SelectedItem = ReflectionHelpers.GetFieldOrProperty <ActionMenuEntry>(action.Default, dataGridView.Columns[dataGridView.CurrentCell.ColumnIndex].DataPropertyName);
         dataGridView.EndEdit();
     }
 }
Ejemplo n.º 29
0
 public static void ResetMenu(this ActionMenu actionMenu)
 {
     RadialPuppetManager.CloseRadialMenu();
     FourAxisPuppetManager.CloseFourAxisMenu();
     actionMenu.ClosePuppetMenus(true);
     for (var i = 0; i < actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0._items.Count; i++)
     {
         actionMenu.DestroyPage(actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0._items[i]);
     }
     actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0?.Clear();
     actionMenu.field_Public_List_1_ObjectNPublicPaSiAcObUnique_0?.Clear();
 }
Ejemplo n.º 30
0
 private void dataGridView_CellToolTipTextNeeded(object sender, DataGridViewCellToolTipTextNeededEventArgs e)
 {
     if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0) &&
         (dataGridView[e.ColumnIndex, e.RowIndex] is DataGridViewComboBoxCell) &&
         (dataGridView.Rows[e.RowIndex].DataBoundItem is ActionMenu))
     {
         ActionMenu menu = dataGridView.Rows[e.RowIndex].DataBoundItem as ActionMenu;
         if (menu.Default != null)
         {
             e.ToolTipText = "Default: " + menu.Default.MenuAction.ToString();
         }
     }
 }
Ejemplo n.º 31
0
    void Update()
    {
        agent.updateRotation = false;
        agent.destination    = game.playerPosition;

        currentPos = ActionMenu.ConvertToWalkPos(new Vector2(this.transform.position.x, this.transform.position.z));

        if (agent.velocity != Vector3.zero && Time.time > posUpdateTime)
        {
            posUpdateTime = Time.time + .1f;
            sender.SendCurrentPos(new Vector2(this.transform.position.x, this.transform.position.z));
        }
    }
Ejemplo n.º 32
0
 GetPedalOptionPrefab(this ActionMenu actionMenu)     //Build 1093 menu.field_Public_GameObject_1
 {
     if (pedalOptionPrefabProperty != null)
     {
         return((GameObject)pedalOptionPrefabProperty.GetValue(actionMenu));
     }
     pedalOptionPrefabProperty = typeof(ActionMenu).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                                 .Single(
         p => p.PropertyType == typeof(GameObject) &&
         ((GameObject)p.GetValue(actionMenu)).name.Equals("PedalOption")
         );
     return((GameObject)pedalOptionPrefabProperty.GetValue(actionMenu));
 }
Ejemplo n.º 33
0
        public override async Task ConfigureUIAsync()
        {
            await base.ConfigureUIAsync();

            var textArea = new TextArea()
            {
                Text = Model.InitialText,
                VerticalAlignment = VerticalAlignment.Stretch
            };

            SetContent(textArea);

            var readButton = new MenuButton()
            {
                Title     = Strings.Read,
                IsEnabled = Model.FileExists,
                Action    = async(button) => textArea.Text = await File.ReadAllTextAsync(Model.FileName)
            };

            var writeButton = new MenuButton()
            {
                Title     = Strings.Write,
                IsEnabled = Model.FileExists,
                Action    = async(button) =>
                {
                    Alert resultAlert = null;
                    try
                    {
                        await File.WriteAllTextAsync(Model.FileName, textArea.Text);

                        readButton.IsEnabled = true;
                        resultAlert          = new Alert(Strings.FileWrittenSuccessfully, string.Empty);
                    }
                    catch (Exception e)
                    {
                        resultAlert = new Alert(e.Message, Strings.IOWriteError);
                    }

                    resultAlert.AddButton(new AlertButton(Strings.OK));
                    resultAlert.Show();
                }
            };

            Menu = new ActionMenu()
            {
                MaxDisplayItems = 2,
                Items           = { writeButton, readButton }
            };

            textArea.TextChanged += (o, e) => writeButton.IsEnabled = !string.IsNullOrEmpty(e.NewText);
        }
Ejemplo n.º 34
0
    // Use this for initialization
    void Start()
    {
        battle = gameObject.GetComponent<Battle>();
        enemyAIController = gameObject.GetComponent<EnemyAIController>();
        actionMenu = GameObject.Find("Main Camera").GetComponent<ActionMenu>();
        moveConfirmMenu = GameObject.Find("Main Camera").GetComponent<MoveConfirmMenu>();

        levelStart = true;
        playerTurn = false;
        enemyTurn = false;
        attackMode = false;
        charIsMoving = false;
        displayAttackRange = false;
        previousMenu = "";
        enemySelected = null;
        AddAllEnemies();
        AddAllPlayers();
        mapCam.enabled = true;
        battleCam.enabled = false;
        victory = false;
        defeat = false;
        //displayTurnText = true;
        //playerTurnStart = false;
        //enemyTurnStart = false;
        displayTurnTimer = displayTurnTextConst;
        audio.loop = true;

        //players = GameObject.FindGameObjectsWithTag("Player");
        //cursorSelection = GameObject.Find("Cursor").GetComponent<CursorSelection>();
    }
Ejemplo n.º 35
0
    //private CursorSelection cursorSelect;
    // Use this for initialization
    void Start()
    {
        isCharSelected = false;
        selectedCharName = "";
        actMenu = GameObject.Find("Main Camera").GetComponent<ActionMenu>();   // Initialize the ActionMenu variable to the Main Camera component
        gameController = GameObject.Find("GameController").GetComponent<GameController>();

        /* Initialize the CharacterState variable to the component on the current character
           script is attached to */
        charState = gameObject.GetComponent<CharacterState>();
        //cursorSelect = GameObject.Find("Cursor").GetComponent<CursorSelection>();
        //cursorSelect = theCursor.GetComponent<CursorSelection>();
    }
Ejemplo n.º 36
0
 public void setHovering(GameObject newHovering)
 {
     if (newHovering != null)
         {
         hovering = newHovering;
         hoveringTooltip = newHovering.GetComponent<Tooltip>();
         hoveringActionMenu = newHovering.GetComponent<ActionMenu>();
         }
     else
         {
         hovering = null;
         hoveringTooltip = null;
         hoveringActionMenu = null;
         }
 }
Ejemplo n.º 37
0
 //private CharacterSelected charSelect;   // References the CharacterSelected component
 // Use this for initialization
 void Start()
 {
     actionMenu = GameObject.Find("Main Camera").GetComponent<ActionMenu>();
     moveConfirmMenu = GameObject.Find("Main Camera").GetComponent<MoveConfirmMenu>();
     //cursorMove = GameObject.Find("Cursor").GetComponent<CursorMovement>();
     emptyTileMenu = GameObject.Find("Main Camera").GetComponent<EmptyTileMenu>();
     gameController = GameObject.Find("GameController").GetComponent<GameController>();
     battle = GameObject.Find("GameController").GetComponent<Battle>();
     //gridWorld = GameObject.Find("Grid").GetComponent<GridWorld>();
     curMove = GameObject.Find("Cursor").GetComponent<CursorMovement>();
     isSelected = false;
     moveMode = false;
     selectedPlayerName = "";
     //charSelect = null;
 }
Ejemplo n.º 38
0
	//private float Lifebar_distance_y=0;
	//private float Lifebar_back_distance_y=0;
	//--


	protected virtual void Start()
	{
		audioManager = GameObject.Find("AudioManager").GetComponent<AudioManager>();
		displayMessage = GameObject.Find ("TurnManager").GetComponent<DisplayMessage> ();
		//Lifebar_distance_y = this.transform.position.y-Lifebar.transform.position.y;
		aux_d = Lifebar.GetComponent<Renderer>().bounds.size.x;//lifebar width
		initial_localscale = new Vector3 (Lifebar.transform.localScale.x,Lifebar.transform.localScale.y,Lifebar.transform.localScale.z);
		//--
		circleCollider = GetComponent<CircleCollider2D> ();
		rb2D = GetComponent<Rigidbody2D> ();
		inverseMoveTime = 1f / moveTime;
		moved = true;
		isAttacking = false;
		attackerDamage = 0;
		hasMoved = false;
		hasAttacked = false;
		isdead = false;
		stopped = true;
		selected = false;

		newAnimation = false;
		myDirection = directions [0];
		myPlayer = this.GetComponentInParent<Player> (); // gets the photon view of parent player class
		if (myPlayer == null) { // Player2 denotes enemy, still unused but can be changed later
			transform.gameObject.tag = "Player2";
			//transform.SetParent(GameObject.FindGameObjectWithTag("Player").transform);
			transform.SetParent(GameObject.FindGameObjectsWithTag("Player")[1].transform);
			myPlayer = this.GetComponentInParent<Player> ();
		}

		GameObject go = GameObject.FindGameObjectWithTag ("Canvas");
		actionMenu = (ActionMenu)go.transform.FindChild ("ActionMenu(Clone)").GetComponent<ActionMenu>();

		//healthValue = 50; //TODO read in health value by calculating from level
		startingHealth = healthValue;
	}
Ejemplo n.º 39
0
 // Use this for initialization
 void Start()
 {
     currentHealth = maxHealth;
     info = gameObject.GetComponent<VictimInfo>();
     if(actionMenu == null)
     {
         actionMenu = GameObject.Find("Main Camera").GetComponent<ActionMenu>();
         log = GameObject.Find("HUD").GetComponent<Log>();
     }
 }
Ejemplo n.º 40
0
    private void setupActionMenu()
    {
        storedTooltipBounds = tooltipBounds;
        storedTooltipText = hoveringTooltip.getDisplayedName();
        storedActionMenu = hoveringActionMenu;

        for (int x = 0; x < storedActionMenu.action.Length; x++)
            {
            if (storedActionMenu.action[x].Length * BOX_CHAR_WIDTH + MENU_MARGIN > menuWidth)
                {
                menuWidth = storedActionMenu.action[x].Length * BOX_CHAR_WIDTH + MENU_MARGIN;
                }
            }

        menuHeight = storedActionMenu.action.Length * (BOX_CHAR_HEIGHT + mainSkin.button.padding.top + mainSkin.button.padding.bottom
                                                        + mainSkin.button.margin.bottom + MENU_MARGIN);

        menuX = Event.current.mousePosition.x - (menuWidth * .5f);
        menuY = Event.current.mousePosition.y;

        if (menuX < 0)
            { menuX = 0; }
        else if (menuX + menuWidth > Screen.width)
            { menuX = Screen.width - menuWidth; }

        if (menuY + menuHeight > Screen.height)
            { menuY = Screen.height - menuHeight; }

        actionMenuOpen = true;
    }