Example #1
0
        public void OnClickSubMenu(BaseEventData eventData, MenuItemActionType a)
        {
            if (TempState != SelectTurnState.ItemSubMenu)
            {
                return;
            }

            if (KeyControlInformation.Info.OnLeftClick(eventData) == true)
            {
                if (CommonFunction.IsDoubleClick())
                {
                    KeyControlInformation.Info.SetPushKeyOneTime(KeyType.MenuOk, true);
                    //TempState = ExeSubMenu();
                    //IsClick = true;
                }
                else
                {
                    //サウンドを鳴らす
                    SoundInformation.Sound.Play(SoundInformation.SoundType.MenuMove);

                    CommonFunction.SetItemUnSelectBack(_ListViewItemSubUnits[subSelected]);
                    subSelected = a;
                    CommonFunction.SetItemSelectBack(_ListViewItemSubUnits[subSelected]);
                }
            }
            else if (KeyControlInformation.Info.OnRightClick(eventData) == true)
            {
                KeyControlInformation.Info.SetPushKeyOneTime(KeyType.MenuCancel, true);
            }
        }
Example #2
0
        private void InitializeItemSubMenu()
        {
            //前回の表示項目を削除
            foreach (GameObject g in _ListViewItemSubUnits.Values)
            {
                UnityEngine.Object.Destroy(g);
            }
            _ListViewItemSubUnits.Clear();

            _MenuItemAction.SetActive(true);
            _MenuItemAction.transform.localPosition = new Vector3(SubMenuDefaultX, SubMenuDefaultY, CommonConst.SystemValue.UiVectorZ);
            //選択されたアイテムを取得
            BaseItem item = _LastTarget[nowType];

            //一番上を選択状態にする
            subSelected = 0;

            //表示対象を取得
            _subItemMenu = item.GetItemAction();

            sbyte i = 0;

            foreach (MenuItemActionType target in _subItemMenu.Values)
            {
                //コピーを作成
                GameObject obj = CommonFunction.SetItemChild(_MenuItemActionItem, _MenuItemActionPosition);

                //行動名の設定
                obj.transform.Find("Text").GetComponent <Text>().text = CommonFunction.MenuItemActionTypeName[target];
                obj.transform.localPosition = new Vector3(0, SubViewItemUnitHeight * i, 0);
                CommonFunction.SetItemUnSelectBack(obj);
                _ListViewItemSubUnits.Add(target, obj);

                //イベントハンドラの設定
                CommonFunction.AddListenerMenu(obj, EventTriggerType.PointerDown, e => OnClickSubMenu(e, target));

                obj.SetActive(true);

                i++;
            }
            subSelected = _ListViewItemSubUnits.Keys.First();


            //一件目を選択状態にする
            CommonFunction.SetItemSelectBack(_ListViewItemSubUnits[subSelected]);
        }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);

        if (label.text != "Menu Item Data")
        {
            EditorGUILayout.Space(10);
            EditorGUILayout.HelpBox("Item: " + property.FindPropertyRelative("Text").stringValue, MessageType.Info);
        }

        EditorGUILayout.PropertyField(property.FindPropertyRelative("Text"), new GUIContent("Name"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("HelpText"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("ItemType"));


        int enumValue = property.FindPropertyRelative("ItemType").enumValueIndex;
        //int enumValue = 1;
        //typeOfItem = (ActionType)EditorGUILayout.EnumPopup("Type", typeOfItem);

        //MenuItemActionType actionType = MenuItemActionType.NewWindow;
        MenuItemActionType actionType = (MenuItemActionType)enumValue;

        switch (actionType)
        {
        case MenuItemActionType.PerformAction:
            EditorGUILayout.PropertyField(property.FindPropertyRelative("ActionEvent"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("ATBCost"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("MPCost"));
            //EditorGUILayout.Space(10);
            break;

        case MenuItemActionType.NewWindow:

            var list = property.FindPropertyRelative("WindowsToOpen");
            var pos  = EditorGUILayout.GetControlRect();
            pos.width /= 2;

            if (GUI.Button(pos, "Add window"))
            {
                list.InsertArrayElementAtIndex(list.arraySize);
            }
            pos.x += pos.width;
            if (GUI.Button(pos, "Clear windows"))
            {
                list.ClearArray();
            }

            for (int i = 0; i < list.arraySize; i++)
            {
                var listItem = list.GetArrayElementAtIndex(i);
                EditorGUILayout.PropertyField(listItem);
            }

            break;

        case MenuItemActionType.NewMenuSection:
            EditorGUILayout.PropertyField(property.FindPropertyRelative("DynamicMenuObject"));
            break;

        default:
            break;
        }

        //MenuItemEditorWindow window = (MenuItemEditorWindow)EditorWindow.GetWindow(typeof(MenuItemEditorWindow), false, "Edit window");

        EditorGUI.EndProperty();
        //EditorGUI.indentLevel--;
    }
Example #4
0
        private TurnState UpdateItemSubMenu(TurnState nowState, PlayerCharacter player)
        {
            //上
            if (KeyControlInformation.Info.OnMoveUp())
            {
                //表示リストが0だったら無視
                if (_ListViewItemSubUnits.Count == 0)
                {
                }
                //最初の項目だったら無視
                else if (_ListViewItemSubUnits.Keys.First() == subSelected)
                {
                }
                //それ以外だったら1つ上の項目に移動
                else
                {
                    //サウンドを鳴らす
                    SoundInformation.Sound.Play(SoundInformation.SoundType.MenuMove);

                    ManageWait.Info.WaitSelect();
                    CommonFunction.SetItemUnSelectBack(_ListViewItemSubUnits[subSelected]);
                    //選択中の番号を取得
                    int index = _ListViewItemSubUnits.Keys.ToList().IndexOf(subSelected);
                    index--;
                    subSelected = _ListViewItemSubUnits.Keys.ElementAt(index);
                    //背景を更新
                    CommonFunction.SetItemSelectBack(_ListViewItemSubUnits[subSelected]);
                }
            }
            //下
            else if (KeyControlInformation.Info.OnMoveDown())
            {
                //表示リストが0だったら無視
                if (_ListViewItemUnits.Count == 0)
                {
                }
                //最後の項目だったら無視
                else if (_ListViewItemSubUnits.Keys.Last() == subSelected)
                //else if (subSelected == _ListViewItemSubUnits.Count - 1)
                {
                }
                //それ以外だったら1つ下の項目に移動
                else
                {
                    //サウンドを鳴らす
                    SoundInformation.Sound.Play(SoundInformation.SoundType.MenuMove);

                    ManageWait.Info.WaitSelect();
                    CommonFunction.SetItemUnSelectBack(_ListViewItemSubUnits[subSelected]);
                    //選択中の番号を取得
                    int index = _ListViewItemSubUnits.Keys.ToList().IndexOf(subSelected);
                    index++;
                    subSelected = _ListViewItemSubUnits.Keys.ElementAt(index);
                    //背景を更新
                    CommonFunction.SetItemSelectBack(_ListViewItemSubUnits[subSelected]);
                }
            }

            //キャンセル
            else if (KeyControlInformation.Info.OnKeyDownMenu(KeyType.MenuCancel))
            //else if (Input.GetKeyDown(KeyControlInformation.Info.MenuCancel))
            {
                //サウンドを鳴らす
                SoundInformation.Sound.Play(SoundInformation.SoundType.MenuCancel);

                //ステートをメニューに返す
                nowState             = TurnState.ItemMenu;
                nowType              = beforeType;
                _LastTarget[nowType] = beforeTarget;
                InitializeItemMenu();
                FinishSub();
            }
            //決定
            else if (KeyControlInformation.Info.OnKeyDownMenu(KeyType.MenuOk))
            //else if (Input.GetKeyDown(KeyControlInformation.Info.MenuOk))
            {
                nowState = ExeSubMenu(nowState, player);
            }
            //else if (IsClick == true)
            //{
            //    nowState = TempState;
            //    IsClick = false;
            //}

            return(nowState);
        }
Example #5
0
 public MenuItemMetadata(MenuItemActionType actionType)
 {
     ActionType = actionType;
 }