Exemplo n.º 1
0
 void Start()
 {
     FirstSetCheck = true;
     EventSystem.current.SetSelectedGameObject(null);
     if (SetScript == null)
     {
         SetScript = GetComponentInParent <jInputSettings>();
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] Error!! jInputSettings script is Not Found!!");
     }
     if (FirstSelectedPlayer == null)
     {
         if (transform.parent.Find("PlayerMappingNums/Player1MappingNum").gameObject)
         {
             FirstSelectedPlayer = transform.parent.Find("PlayerMappingNums/Player1MappingNum").gameObject;
         }
         else
         {
             Debug.LogError("[jInput] Error!! Player1MappingNum is Not Found!!");
         }
     }
     if (PrevSelectedPlayer == null && FirstSelectedPlayer != null)
     {
         PrevSelectedPlayer = FirstSelectedPlayer;
     }
 }
Exemplo n.º 2
0
 void Start()
 {
     if (SetScript == null)
     {
         if (GetComponent <jInputSettings>())
         {
             SetScript = GetComponent <jInputSettings>();
         }
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] Error!! jInputSetting script is Not Found!!");
     }
     if (SaveConfirmWindow == null)
     {
         if (transform.Find("ConfirmWindow"))
         {
             SaveConfirmWindow = transform.Find("ConfirmWindow").gameObject;
         }
     }
     if (SaveConfirmWindow == null)
     {
         Debug.LogError("[jInput] Error!! ConfirmWindow gameObject is Not Found!!");
     }
 }
Exemplo n.º 3
0
    void Start()
    {
        if (SetScript == null)
        {
            SetScript = GetComponentInParent <jInputSettings>();
        }
        if (SetScript == null)
        {
            Debug.LogError("[jInput] jInputSettings script is Not Found!!");
        }

        if (ThisButton == null)
        {
            ThisButton = GetComponent <Button>();
        }
        if (ThisButton != null)
        {
            BaseHighlightedThisButtonColor = ThisButton.colors.highlightedColor;
            PrevNavMode = ThisButton.navigation.mode;
        }
        else
        {
            Debug.LogError("[jInput] Error!! Button component is Not Found!!");
        }
    }
Exemplo n.º 4
0
 void Start()
 {
     if (SetScript == null)
     {
         SetScript = GetComponentInParent <jInputSettings>();
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] Error!! jInputSettings script is Not Found!!");
     }
     if (transform.Find("TextPrefab") && transform.Find("TextPrefab").GetComponent <TextMesh>())
     {
         ThisTextMesh = transform.Find("TextPrefab").GetComponent <TextMesh>();
     }
     if (GetComponent <Text>())
     {
         ThisTextCpnt = GetComponent <Text>();
     }
     if (ThisTextMesh == null && ThisTextCpnt == null)
     {
         Debug.LogError("[jInput] Error!! Text Display component on PlayerSelectNumText is Not Found!!");
     }
     if (ThisTextMesh != null)
     {
         ThisTextMesh.text = "";
     }
     if (ThisTextCpnt != null)
     {
         ThisTextCpnt.text = "";
     }
 }
Exemplo n.º 5
0
    void Update()
    {
        if (MappingSet != null)
        {
            if (MappingSet.activeSelf)
            {
                gameObject.GetComponent <DemoCube>().enabled = false;
            }
            else
            {
                gameObject.GetComponent <DemoCube>().enabled = true;
            }
        }
        else
        {
            gameObject.GetComponent <DemoCube>().enabled = true;
        }

        if (jInputSetScript == null)
        {
            jInputSetScript = MappingSet.GetComponent <jInputSettings>();
        }
        if (jInputSetScript != null)
        {
            if (gameObject.GetComponent <DemoCube>().enabled)
            {
                if (jInputSetScript.PlayerNum > 1)
                {
                    GetComponent <DemoCube>().SomePlayersCheck = true;
                }
                else
                {
                    GetComponent <DemoCube>().SomePlayersCheck = false;
                }
            }
        }

        viewPos = DemoCamera.WorldToViewportPoint(transform.position);
        if (viewPos.x < 0.07f)
        {
            LimitPosi          = DemoCamera.ViewportToWorldPoint(new Vector3(0.08f, viewPos.y, viewPos.z));
            transform.position = LimitPosi;
        }
        else if (viewPos.x > 0.93f)
        {
            LimitPosi          = DemoCamera.ViewportToWorldPoint(new Vector3(0.92f, viewPos.y, viewPos.z));
            transform.position = LimitPosi;
        }
        if (viewPos.y < 0.08f)
        {
            LimitPosi          = DemoCamera.ViewportToWorldPoint(new Vector3(viewPos.x, 0.1f, viewPos.z));
            transform.position = LimitPosi;
        }
        else if (viewPos.y > 0.92f)
        {
            LimitPosi          = DemoCamera.ViewportToWorldPoint(new Vector3(viewPos.x, 0.9f, viewPos.z));
            transform.position = LimitPosi;
        }
    }
Exemplo n.º 6
0
 static void SetScriptSearch()
 {
     if (jInputSettings.MappingSetList != null && jInputSettings.MappingSetList.Count > 0 && jInputSettings.MappingSetList[0] != null)
     {
         if (jInputSettings.MappingSetList[0].GetComponent <jInputSettings>())
         {
             SetScript = jInputSettings.MappingSetList[0].GetComponent <jInputSettings>();
         }
     }
 }
Exemplo n.º 7
0
 static void SyncValuesSOData()
 {
     if (jInputSettings.MappingSetList != null && jInputSettings.MappingSetList.Count > 0 && jInputSettings.MappingSetList[0] != null)
     {
         if (SetScript = jInputSettings.MappingSetList[0].GetComponent <jInputSettings>())
         {
             SetScript.SODataRenew();
         }
     }
 }
Exemplo n.º 8
0
 void Start()
 {
     if (SetScript == null)
     {
         SetScript = GetComponentInParent <jInputSettings>();
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] jInputSettings script is Not Found!!");
     }
 }
Exemplo n.º 9
0
    void Start()
    {
        if (SetScript == null)
        {
            SetScript = GetComponentInParent <jInputSettings>();
        }
        if (SetScript == null)
        {
            Debug.LogError("[jInput] jInputSettings script is Not Found!!");
        }
        NameCheck = gameObject.name.IndexOf("MapperMenuItem");
        if (NameCheck != 0 || gameObject.name.Length != 16)
        {
            Debug.LogError("[jInput] Error!! To be necessary MapperMenuItem Object naming 'MapperMenuItem'+ serial number of double figures 00 to 30.");
        }
        else
        {
            MenuNumString = gameObject.name.Substring(gameObject.name.Length - 2, 2);
            MenuNum       = int.Parse(MenuNumString);
        }
        if (SetScript != null)
        {
            HeadingText = SetScript.MenuItemHeadings[MenuNum];
        }
        if (CommonSettingScript = transform.parent.GetComponent <MenuItemsCommonSetting>())
        {
            HeadingRelativePosi = CommonSettingScript.HeadingRelativePosi;
        }
        else
        {
            Debug.LogError("[jInput] Error!! MenuItemsCommonSetting script is Not Found!");
        }
        if (ThisTextMesh == null)
        {
            ThisTextMesh = transform.Find("TextPrefab").GetComponent <TextMesh>();
        }
        if (HeadingObject == null)
        {
            HeadingObject = transform.Find("HeadingTextPrefab").gameObject;
        }
        HeadingObject.GetComponent <TextMesh>().text = HeadingText;
        HeadingObject.transform.position             = transform.position + transform.right * HeadingRelativePosi.x + transform.up * HeadingRelativePosi.y;
#if (UNITY_EDITOR)
        if (EditorApplication.isPlaying || EditorApplication.isPaused)
        {
#endif
        RndMaterial = GetComponent <Renderer>().material;
        HeadingTextPour();
#if (UNITY_EDITOR)
    }
#endif
    }
Exemplo n.º 10
0
 void Start()
 {
     if (SetScript == null)
     {
         SetScript = GetComponentInParent <jInputSettings>();
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] jInputSettings script is Not Found!!");
     }
     if (TextComponent == null)
     {
         TextComponent = transform.Find("TextPrefab").gameObject.GetComponent <TextMesh>();
     }
 }
Exemplo n.º 11
0
    void Update()
    {
        #if (UNITY_EDITOR)
        if (!EditorApplication.isPlaying && !EditorApplication.isPaused)
        {
            if (SetScript == null)
            {
                SetScript = GetComponentInParent <jInputSettings>();
            }
            if (ThisHeadingTextCpnt == null && transform.Find("HeadingText").GetComponent <Text>() != null)
            {
                ThisHeadingTextCpnt = transform.Find("HeadingText").GetComponent <Text>();
            }
            HeadingTextPour();
            if (InputText == null)
            {
                InputText = transform.Find("Button/Text").GetComponent <Text>();
            }
            if (InputText != null)
            {
                InputText.text = "Key Name";
            }
        }
        else
        {
            #endif
        if (EventSystem.current.currentSelectedGameObject == this.gameObject ||
            EventSystem.current.currentSelectedGameObject == ThisButtonGO)
        {
            SetScript.CullentTextCpnt = InputText;
        }

        if (AlertMarkGO != null)
        {
            if (AlertMarkCheck)
            {
                AlertMarkGO.SetActive(true);
            }
            else
            {
                AlertMarkGO.SetActive(false);
            }
        }
            #if (UNITY_EDITOR)
    }
        #endif
    }
Exemplo n.º 12
0
 static void MyhierarchyChanged()
 { //アセットのインポート時,シーン起動時,Inspector変更時,Play停止時に実行
     if (!EditorApplication.isPlaying && !EditorApplication.isPaused && !EditorApplication.isPlayingOrWillChangePlaymode)
     {
         if (StartingOnceCheck == false)
         {
             if (jInputSettings.MappingSetList != null && jInputSettings.MappingSetList.Count > 0 && jInputSettings.MappingSetList[0] != null)
             {
                 if (SetScript = jInputSettings.MappingSetList[0].GetComponent <jInputSettings>())
                 {
                     SetScript.DefaultArrayCopyReset(); //シーン起動時のみ実行
                     StartingOnceCheck = true;
                 }
             }
         }
     }
 }
Exemplo n.º 13
0
 static void MyPlaymodeChanged()
 { //Play開始時と停止時に実行
     //MyPlaymodeChanged()のほうがMyhierarchyChanged()より実効が早い
     //以下はisPlayingOrWillChangePlaymodeによりPlay停止時のみ
     if (!EditorApplication.isPlaying && !EditorApplication.isPaused && !EditorApplication.isPlayingOrWillChangePlaymode)
     {
         if (jInputSettings.MappingSetList != null && jInputSettings.MappingSetList.Count > 0 && jInputSettings.MappingSetList[0] != null)
         {
             if (SetScript = jInputSettings.MappingSetList[0].GetComponent <jInputSettings>())
             {
                 SetScript.jInputSOData.AxesSetApply();
                 SetScript.AxesReadFromSOData();
             }
         }
     }
     StartingOnceCheck = true;
 }
Exemplo n.º 14
0
 void Update()
 {
     if (MappingSet != null)
     {
         if (jInputSetScript == null)
         {
             jInputSetScript = MappingSet.GetComponent <jInputSettings>();
         }
         if (jInputSetScript != null)
         {
             if (jInputSetScript.DefaKeySetModeCheck)
             {
                 gameObject.SetActive(false);
             }
         }
     }
 }
Exemplo n.º 15
0
 void Start()
 {
     if (SetScript == null)
     {
         SetScript = GetComponent <jInputSettings>();
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] Error!! jInputSettings script is Not Found!!");
     }
     if (Selection != null)
     {
         Selection.SetActive(false);
     }
     else
     {
         Debug.LogError("[jInput] Error!! Selection gameObject is Not Found!!");
     }
 }
Exemplo n.º 16
0
 void Start()
 {
     if (SetScript == null)
     {
         SetScript = GetComponent <jInputSettings>();
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] Error!! jInputSettings script is Not Found!!");
     }
     if (SelectionGO != null)
     {
         SelectionGO.SetActive(false);
     }
     else
     {
         Debug.LogError("[jInput] Error!! Selection is Not Found!!");
     }
     FirstSelectCheck = true;
 }
Exemplo n.º 17
0
 void Start()
 {
     if (SetScript == null)
     {
         SetScript = GetComponentInParent <jInputSettings>();
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] jInputSettings script is Not Found!!");
     }
     TextComponent = transform.Find("TextPrefab").gameObject.GetComponent <TextMesh>();
     RndMaterial   = GetComponent <Renderer>().material;
     if (SetScript != null)
     {
         Selection = SetScript.transform.Find("Selection").gameObject;
     }
     if (Selection == null)
     {
         Debug.LogError("[jInput] Selection object is Not Found!!");
     }
 }
Exemplo n.º 18
0
 void Start()
 {
     if (SetScript == null)
     {
         SetScript = GetComponentInParent <jInputSettings>();
     }
     if (SetScript == null)
     {
         Debug.LogError("[jInput] jInputSettings script is Not Found!!");
     }
     ParentGO = transform.parent.gameObject;
     if (ParentGO == null)
     {
         Debug.LogError("[jInput] Error!! ParentGO is Not Found!!");
     }
     if (ParentGO.GetComponent <Button>())
     {
         ThisButton = ParentGO.GetComponent <Button>();
     }
     else if (GetComponent <Button>())
     {
         ThisButton = GetComponent <Button>();
     }
 }
Exemplo n.º 19
0
    void Update()
    {
#if (UNITY_EDITOR)
        if (!EditorApplication.isPlaying && !EditorApplication.isPaused)
        {
            if (SetScript == null)
            {
                SetScript = GetComponentInParent <jInputSettings>();
            }
            if (HeadingObject == null)
            {
                HeadingObject = transform.Find("HeadingTextPrefab").gameObject;
            }
            HeadingTextPour();
            if (ThisTextMesh == null)
            {
                ThisTextMesh = transform.Find("TextPrefab").GetComponent <TextMesh>();
            }
            if (ThisTextMesh != null)
            {
                ThisTextMesh.text = "Key Name";
            }
        }
        else
        {
#endif

        if (SetScript != null)
        {
            if (ThisTextMesh != null)
            {
                if (DuplicationTextColor && InputWaiting != true)
                {
                    if (SetScript.SelectPosition == MenuNum && SetScript.OperateItemLine != true && SetScript.FirstSet != true)
                    {
                        if (SetScript.MappingMode)
                        {
                            ThisTextMesh.color = SameFontWaitInput;                                     //With sameText, Color of wait Key-in
                        }
                        else
                        {
                            ThisTextMesh.color = SameFontSelect;                                     //With sameText, Select Color of normal
                        }
                    }
                    else
                    {
                        if (SetScript.MappingMode)
                        {
                            ThisTextMesh.color = SameFontOtherInput;                                     //With sameText, NonSelect Color of wait Key-in
                        }
                        else
                        {
                            ThisTextMesh.color = SameFontNormal;                                     //With sameText, NonSelect Color of normal
                        }
                    }
                }
                else
                {
                    if (SetScript.SelectPosition == MenuNum && SetScript.OperateItemLine != true && SetScript.FirstSet != true)
                    {
                        if (SetScript.MappingMode)
                        {
                            ThisTextMesh.color = FontWaitInput;                                     //Select TextColor of wait Key-in
                        }
                        else
                        {
                            ThisTextMesh.color = FontSelectColor;                                     //Select TextColor of normal
                        }
                    }
                    else
                    {
                        if (SetScript.MappingMode)
                        {
                            ThisTextMesh.color = FontOtherInput;                                     //NonSelect TextColor of wait Key-in
                        }
                        else
                        {
                            ThisTextMesh.color = FontNormalColor;                                     //NonSelect TextColor of normal
                        }
                    }
                }

                if (RndMaterial != null)
                {
                    if (SetScript.SelectPosition == MenuNum && SetScript.OperateItemLine != true && SetScript.FirstSet != true)
                    {
                        SetScript.CullentTextMesh = ThisTextMesh;
                        if (SetScript.FirstSet != true)
                        {
                            if (SetScript.MappingMode)
                            {                                     //BackColor of wait Key-in
                                RndMaterial.SetColor("_Color", BackWaitInput);
                                if (InputWaiting != true)
                                {
                                    InputWaiting           = true;
                                    SetScript.PreviousText = HoldingText;
                                    ThisTextMesh.text      = "Input...";
                                }
                            }
                            else
                            {                                     //BackColor of select
                                RndMaterial.SetColor("_Color", BackSelectColor);
                                HoldingText  = ThisTextMesh.text;
                                InputWaiting = false;
                            }
                        }
                    }
                    else
                    {                             //BackColor of normal
                        if (SetScript.MappingMode)
                        {                         //Other wait Key-in
                            RndMaterial.SetColor("_Color", BackNormalColor - new Color(0.1f, 0.05f, 0.05f, 0.1f));
                            HoldingText  = ThisTextMesh.text;
                            InputWaiting = false;
                        }
                        else
                        {                                 //normal
                            RndMaterial.SetColor("_Color", BackNormalColor);
                            HoldingText  = ThisTextMesh.text;
                            InputWaiting = false;
                        }
                    }
                }
            }
        }

        if (AlertMarkCheck)
        {
            if (AlertMarkDisplaying != true)
            {
                AlertMarkDisplaying = true;
                AlertMarkObject     = Instantiate(CommonSettingScript.AlertMarkPrefab) as GameObject;
                AlertMarkObject.transform.position = transform.position + new Vector3(-(transform.lossyScale.x * 0.47f), (transform.lossyScale.y * 0.22f), -1);
                AlertMarkObject.transform.SetParent(transform);
            }
        }
        else
        {
            AlertMarkDisplaying = false;
            if (AlertMarkObject != null)
            {
                Destroy(AlertMarkObject);
            }
        }

#if (UNITY_EDITOR)
    }
#endif

        if (CommonSettingScript != null && HeadingObject != null)
        {
            HeadingRelativePosi = CommonSettingScript.HeadingRelativePosi;
            HeadingObject.transform.position = transform.position + transform.right * HeadingRelativePosi.x + transform.up * HeadingRelativePosi.y;
        }
    }
Exemplo n.º 20
0
    void Start()
    {
        if (SetScript == null)
        {
            SetScript = GetComponentInParent <jInputSettings>();
        }
        if (SetScript == null)
        {
            Debug.LogError("[jInput] jInputSettings script is Not Found!!");
        }
        MenuItemButtonGOsAry = new GameObject[SetScript.MenuItemHeadings.Length];
        OperateItemsAry      = new GameObject[4];
        FirstSelectCheck     = true;
        StartSelectNullCheck = true;
        FromMostOverCheck    = false;
        FromMostUnderCheck   = false;
        EndToEndCheck        = false;
        IntoRectFalse();

        if (MenuItemsGO != null)
        {
            for (int i = 0; i < MenuItemButtonGOsAry.Length; i++)
            {
                for (int j = 0; j < MenuItemsGO.transform.childCount; j++)
                {
                    string     TempFindName = null;
                    GameObject TempItem     = MenuItemsGO.transform.GetChild(j).gameObject;
                    if (0 <= i && i <= 9)
                    {
                        TempFindName = "MapperMenuItem0" + i;
                    }
                    else if (i >= 10)
                    {
                        TempFindName = "MapperMenuItem" + i;
                    }
                    if (TempItem.name == TempFindName)
                    {
                        if (TempItem.transform.Find("Button"))
                        {
                            MenuItemButtonGOsAry[i] = TempItem.transform.Find("Button").gameObject;
                        }
                    }
                }
            }
        }
        else
        {
            Debug.LogError("[jInput] Error!! OperateItemsGO is Not Found!!");
        }
        if (MenuItemButtonGOsAry[0] != null)
        {
            FirstSelectedMenuItem = MenuItemButtonGOsAry[0];
        }
        else
        {
            FirstSelectedMenuItem = transform.parent.Find("InMapperMenuItems/MapperMenuItem00/Button").gameObject;
        }
        if (FirstSelectedMenuItem != null)
        {
            PrevSelectedMenuItem = FirstSelectedMenuItem;
        }
        else
        {
            Debug.LogError("[jInput] Error!! Button in MapperMenuItem00 is Not Found!!");
        }

        if (OperateItemsGO != null)
        {
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < OperateItemsGO.transform.childCount; j++)
                {
                    GameObject TempItem = OperateItemsGO.transform.GetChild(j).gameObject;
                    if (TempItem.name == "MapperOperateItem0" + i)
                    {
                        OperateItemsAry[i] = TempItem;
                        break;
                    }
                }
                if (0 <= i && i < 3)
                {
                    if (OperateItemsAry[i] == null)
                    {
                        Debug.LogError("[jInput] Error!! MapperOperateItem0" + i + " is Not Found!!");
                    }
                }
            }
            OperateItemsSetNonInteractable();
        }
        else
        {
            Debug.LogError("[jInput] Error!! OperateItemsGO is Not Found!!");
        }
        if (transform.GetComponentInParent <UGUIMenuVerticalScroll>())
        {
            VerticalScrollScript = transform.GetComponentInParent <UGUIMenuVerticalScroll>();
            VerticalScrollScript.GetComponent <ScrollRect>().verticalNormalizedPosition = 1;
        }
    }
Exemplo n.º 21
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.Space();
        MenuItemsCommonSetting ItemsCommonScript = target as MenuItemsCommonSetting;

        if (SetScript == null)
        {
            if (ItemsCommonScript.transform.GetComponentInParent <jInputSettings>())
            {
                SetScript = ItemsCommonScript.transform.GetComponentInParent <jInputSettings>();
            }
        }

        if (SetScript != null && SetScript.jInputNonUGUICheck)
        {
            NonUGUICheck     = true;
            AlignInvalidBool = false;
            InMenuItemsTrns  = ItemsCommonScript.transform;
            if (InMenuItemsTrns == null || InMenuItemsTrns.childCount <= 1)
            {
                AlignInvalidBool = true;
            }
            else
            {
                if (BaseItemTrns = InMenuItemsTrns.Find("MapperMenuItem00"))
                {
                }
                else
                {
                    AlignInvalidBool = true;
                }
            }
        }
        else
        {
            NonUGUICheck = false;
        }

        GUI.changed = false;
        DrawDefaultInspector();
        Undo.RecordObject(ItemsCommonScript, "Inspector");

        if (NonUGUICheck)
        {
            ItemsCommonScript.AlertMarkPrefab     = (GameObject)EditorGUILayout.ObjectField("AlertMarkPrefab", ItemsCommonScript.AlertMarkPrefab, typeof(GameObject), true);
            ItemsCommonScript.HeadingRelativePosi = EditorGUILayout.Vector2Field("HeadingRelativePosi", ItemsCommonScript.HeadingRelativePosi);
            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.LabelField("Vertical Align MenuItems");
            EditorGUI.indentLevel++;
            EditorGUI.BeginDisabledGroup(AlignInvalidBool);
            ItemsCommonScript.AlignInterval = EditorGUILayout.Slider("Interval (0.1-5.0)", ItemsCommonScript.AlignInterval, 0.1f, 5.0f);
            if (ItemsCommonScript.AlignInterval < 0.1f)
            {
                ItemsCommonScript.AlignInterval = 0.1f;
            }
            else if (ItemsCommonScript.AlignInterval > 5.0f)
            {
                ItemsCommonScript.AlignInterval = 5.0f;
            }
            EditorGUI.EndDisabledGroup();
            EditorGUI.indentLevel--;
            EditorGUILayout.BeginHorizontal();
            GUILayout.Box("", GUIStyle.none, GUILayout.ExpandWidth(true));
            EditorGUI.BeginDisabledGroup(AlignInvalidBool);
            if (GUILayout.Button("Align", GUILayout.Width(80)))
            {
                if (ItemsCommonScript.AlignInterval < 0.1f)
                {
                    ItemsCommonScript.AlignInterval = 0.1f;
                }
                else if (ItemsCommonScript.AlignInterval > 5.0f)
                {
                    ItemsCommonScript.AlignInterval = 5.0f;
                }
                GUI.FocusControl("");                 //Inspectorのフォーカスを解除して入力欄を更新
                                                      //itemを整列させる
                if (InMenuItemsTrns != null)
                {
                    int           ItemListIndex = -1;
                    List <string> MenuItemsList = new List <string>();
                    for (int i = 0; i < InMenuItemsTrns.childCount; i++)
                    {
                        MenuItemsList.Add(InMenuItemsTrns.GetChild(i).name);
                    }
                    for (int i = 0; i <= 30; i++)
                    {
                        if (0 <= i && i <= 9)
                        {
                            ComparisonName = "MapperMenuItem0" + i;
                        }
                        else if (10 <= i && i <= 30)
                        {
                            ComparisonName = "MapperMenuItem" + i;
                        }
                        if (ComparisonName != null)
                        {
                            ItemListIndex = MenuItemsList.IndexOf(ComparisonName);
                        }
                        if (ItemListIndex == -1)
                        {
                        }
                        else
                        {
                            Transform TemporaryItemTrns = InMenuItemsTrns.Find(ComparisonName);
                            Undo.RecordObject(TemporaryItemTrns, "Inspectoree");
                            TemporaryItemTrns.position = new Vector3(TemporaryItemTrns.position.x, BaseItemTrns.position.y - (ItemsCommonScript.AlignInterval * i), TemporaryItemTrns.position.z);
                        }
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
            GUILayout.Box("", GUIStyle.none, GUILayout.ExpandWidth(false), GUILayout.Width(10));
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();
        }
        EditorGUILayout.Space();
        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 22
0
    static void MyUpdate()
    {
        if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isPlaying || EditorApplication.isPaused)
        {
            if (ExistMappingManagerCheck != true)
            {
                if (GameObject.Find("jInputMappingManager") == null)
                {
                    if (MappingManagerPrefab == null)
                    {
                        //Resources.Loadを使っても良い
                        string[] Pathes = AssetDatabase.FindAssets("jInputMappingManager t:GameObject");
                        if (Pathes.Length >= 1)
                        {
                            string MappingManagerPath = AssetDatabase.GUIDToAssetPath(Pathes[0]);
                            MappingManagerPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(MappingManagerPath);
                        }
                        if (Pathes.Length > 1)
                        {
                            Debug.LogError("[jInput] There are some GameObjects included in the name 'jInputMappingManager' in Project window!! There is a possibility that it may not operate normally.");
                        }
                    }
                    if (MappingManagerPrefab != null)
                    {
                        GameObject Ist = Instantiate(MappingManagerPrefab) as GameObject;
                        Ist.name      = "jInputMappingManager";
                        Ist.hideFlags = HideFlags.HideInHierarchy;
                        Ist.GetComponent <Mapper>().IstCheck = true;
                        ExistMappingManagerCheck             = true;
                    }
                    else
                    {
                        Debug.LogError("[jInput] Error! jInputMappingManager Prefab is Not Found in Project window!!");
                        EditorPlaymodeStop();
                        return;
                    }
                }
            }
        }
        else
        {
            ExistMappingManagerCheck = false;
            GameObject FindMappingManager;
            if (FindMappingManager = GameObject.Find("jInputMappingManager"))
            {
                if (FindMappingManager.GetComponent <Mapper>().IstCheck)
                {
                    DestroyImmediate(GameObject.Find("jInputMappingManager"));
                }
            }
        }


        if (Mapper.EditorPlaymodeStop != false)
        {
            EditorPlaymodeStop();
        }

        //PlayするとjInputMappingSetが非表示だと取れずにエラーになる部分があるのでエディット中だけ動作
        if (!EditorApplication.isPlaying && !EditorApplication.isPaused)
        {
            if (jInputSettings.MappingSetList != null && jInputSettings.MappingSetList.Count > 0)
            {
                if (jInputSettings.MappingSetList.Count > 1 && jInputSettings.MappingSetList.Count != MappingSetListNum)
                {
                    Debug.LogError("[jInput] There are some jInputMappingSet gameObject in the scene! It can works only one!");
                }
                MappingSetListNum = jInputSettings.MappingSetList.Count;
                if (jInputSettings.MappingSetList[0] != null)
                {
                    if (MappingSet == null || MappingSet != jInputSettings.MappingSetList[0])
                    {
                        MappingSet = jInputSettings.MappingSetList[0];
                    }
                }
            }
            if (MappingSet != null)
            {
                if (SetScript == null)
                {
                    SetScript = MappingSet.GetComponent <jInputSettings>();
                }
                if (SetScript != null)
                {
                    if (SetScript.jInputSOData == null)
                    {
                        //Resources.Loadを使っても良い
                        string[] Pathes = AssetDatabase.FindAssets("jInputData t:jInput");
                        if (Pathes.Length >= 1)
                        {
                            string MappingManagerPath = AssetDatabase.GUIDToAssetPath(Pathes[0]);
                            SetScript.jInputSOData = AssetDatabase.LoadAssetAtPath <jInput>(MappingManagerPath);
                        }
                        if (Pathes.Length > 1)
                        {
                            Debug.LogWarning("[jInput] There are some jInputData in this project!");
                        }
                    }

                    if (MappingSet != null && SetScript.jInputSOData != null && SetScript.jInputSOData.DefaultInputNameInconsistencyCheck)
                    {
                        if (!EditorApplication.isPlaying && !EditorApplication.isPaused && EditorApplication.isPlayingOrWillChangePlaymode)
                        {
                            Selection.activeGameObject = MappingSet;
                        }
                    }
                    if (SetScript.transform.Find("MainWindow/InMapperMenuItems") != null)
                    {
                        InMenuItemsTrns = SetScript.transform.Find("MainWindow/InMapperMenuItems");
                    }
                    else
                    {
                        Debug.LogError("[jInput] Error!! gameObject with MenuItemsCommonSetting script is Not Found!!");
                    }
                    if (InMenuItemsTrns != null)
                    {
                        if (InMenuItemsTrns.GetComponent <MenuItemsCommonSetting>().MenuItemPrefab != null)
                        {
                            MenuItemPrefab = InMenuItemsTrns.GetComponent <MenuItemsCommonSetting>().MenuItemPrefab;
                        }
                        else
                        {
                            Debug.LogError("[jInput] Error!! MenuItemPrefab in InMapperMenuItems gameObject is Not Found!!");
                        }
                        if (SetScript.jInputNonUGUICheck != true && InMenuItemsTrns != null)
                        {
                            if (InMenuItemsTrns.parent.Find("SelectedDeliver") != null)
                            {
                                SelectedDeliverButton = InMenuItemsTrns.parent.Find("SelectedDeliver").GetComponent <Button>();
                            }
                            else
                            {
                                Debug.LogError("[jInput] Error!! SelectedDeliver in MainWindow is Not Found!!");
                            }
                        }
                    }
                }

                if (EditorApplication.timeSinceStartup > NextItemCheckTime)
                {
                    if (InMenuItemsTrns != null)
                    {
                        ItemsNum = InMenuItemsTrns.childCount;
                        ItemsNumMatch();
                    }
                    NextItemCheckTime = EditorApplication.timeSinceStartup + 0.25;
                }
            }
        }
    }
Exemplo n.º 23
0
    void Start()
    {
        if (SetScript == null)
        {
            SetScript = GetComponentInParent <jInputSettings>();
        }
        if (SetScript == null)
        {
            Debug.LogError("[jInput] jInputSettings script is Not Found!!");
        }
        NameCheck = gameObject.name.IndexOf("MapperMenuItem");
        if (NameCheck != 0 || gameObject.name.Length != 16)
        {
            Debug.LogError("[jInput] Error!! To be necessary MapperMenuItem Object naming 'MapperMenuItem'+ serial number of double figures 00 to 30.");
        }
        else
        {
            MenuNumString = gameObject.name.Substring(gameObject.name.Length - 2, 2);
            MenuNum       = int.Parse(MenuNumString);
        }

        if (AlertMarkGO == null)
        {
            if (transform.Find("AlertMark"))
            {
                AlertMarkGO = transform.Find("AlertMark").gameObject;
            }
        }
        if (AlertMarkGO != null)
        {
            if (AlertMarkGO.GetComponent <Image>())
            {
                ThisAlertMarkBaseColor = AlertMarkGO.GetComponent <Image>().color;
            }
            #if (UNITY_EDITOR)
            if (EditorApplication.isPlaying || EditorApplication.isPaused)
            #endif
            AlertMarkGO.SetActive(false);
        }
        else
        {
            Debug.LogError("[jInput] Error!! AlertMark gameObject in " + this.gameObject.name + " is Not Found!");
        }

        if (ThisButtonGO == null)
        {
            ThisButtonGO = transform.Find("Button").gameObject;
        }
        if (ThisButtonGO == null)
        {
            Debug.LogError("[jInput] Error!! Button in " + this.gameObject.name + " is Not Found!");
        }
        else
        {
            if (ThisButtonGO.transform.Find("Text"))
            {
                if (ThisButtonGO.transform.Find("Text").GetComponent <Text>())
                {
                    InputText = ThisButtonGO.transform.Find("Text").GetComponent <Text>();
                }
                if (ThisButtonGO.transform.Find("Text").GetComponent <UGUIButtonTextColor>())
                {
                    ButtonTextColorScript = ThisButtonGO.transform.Find("Text").GetComponent <UGUIButtonTextColor>();
                }
            }
            if (InputText == null)
            {
                Debug.LogError("[jInput] Error!! InputText in " + this.gameObject.name + " is Not Found!");
            }
            if (ThisButtonGO.GetComponent <Image>())
            {
                ThisButtonImageCpnt = ThisButtonGO.GetComponent <Image>();
            }
            if (ThisButtonImageCpnt == null)
            {
                Debug.LogError("[jInput] Error!! Image Component with Button in " + this.gameObject.name + " is Not Found!");
            }
            else
            {
                ThisButtonBaseColor = ThisButtonImageCpnt.color;
            }
        }
        if (transform.Find("HeadingText") != null && transform.Find("HeadingText").GetComponent <Text>() != null)
        {
            ThisHeadingTextCpnt  = transform.Find("HeadingText").GetComponent <Text>();
            ThisHeadingBaseColor = ThisHeadingTextCpnt.color;
        }
        if (ThisHeadingTextCpnt == null)
        {
            Debug.LogError("[jInput] Error!! ThisHeadingTextCpnt in " + this.gameObject.name + " is Not Found!");
        }
        if (VerticalScrollScript == null && GetComponentInParent <UGUIMenuVerticalScroll>())
        {
            VerticalScrollScript = GetComponentInParent <UGUIMenuVerticalScroll>();
        }
        if (VerticalScrollScript != null && VerticalScrollScript.UseVerticalScroll)
        {
            UseScrollCheck      = true;
            ScrollRangeRectTrns = VerticalScrollScript.GetComponent <RectTransform>();
        }
        else
        {
            UseScrollCheck = false;
        }

        #if (UNITY_EDITOR)
        if (EditorApplication.isPlaying || EditorApplication.isPaused)
        {
            #endif
        HeadingTextPour();
        //スクロール範囲外で透明~半透明のitemがキー設定窓に移行した瞬間一瞬表示されてしまうので透明にしておく
        if (UseScrollCheck)
        {
            if (ThisButtonImageCpnt != null)
            {
                ThisButtonImageCpnt.color = Color.clear;
            }
            if (ThisHeadingTextCpnt != null)
            {
                ThisHeadingTextCpnt.color = Color.clear;
            }
            if (InputText != null)
            {
                InputText.color = Color.clear;
            }
        }
            #if (UNITY_EDITOR)
    }
        #endif
    }
Exemplo n.º 24
0
    void Update()
    {
        if (!EditorApplication.isPlaying && !EditorApplication.isPaused)
        {
            if (SetScript == null)
            {
                SetScript = GetComponentInParent <jInputSettings>();
            }
            if (SetScript == null)
            {
                Debug.LogError("[jInput] jInputSettings script is Not Found!!");
            }
            if (PlayerMappingNumsGO == null || SetScript == null)
            {
                return;
            }
            if (LayoutGroupCpnt == null && PlayerMappingNumsGO.transform.GetComponent <HorizontalLayoutGroup>())
            {
                LayoutGroupCpnt = PlayerMappingNumsGO.transform.GetComponent <HorizontalLayoutGroup>();
            }

            if (PlayerNum != SetScript.PlayerNum)
            {
                PlayerNumAry = new GameObject[4];

                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < PlayerMappingNumsGO.transform.childCount; j++)
                    {
                        GameObject TempChild = PlayerMappingNumsGO.transform.GetChild(j).gameObject;
                        if (TempChild.name == "Player" + (i + 1) + "MappingNum")
                        {
                            PlayerNumAry[i] = TempChild;
                            if (i < SetScript.PlayerNum)
                            {
                                TempChild.SetActive(true);
                            }
                            else
                            {
                                TempChild.SetActive(false);
                            }
                            break;
                        }
                    }
                    if (i < SetScript.PlayerNum)
                    {
                        if (PlayerNumAry[i] == null)
                        {
                            Debug.LogError("[jInput] Error!! Player" + (i + 1) + "MappingNum gameObject is Not Found!!");
                            return;
                        }
                    }
                }

                if (LayoutGroupCpnt != null)
                {
                    switch (SetScript.PlayerNum)
                    {
                    case 1:
                        break;

                    case 2:
                        //PlayerNumAry[0].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[0].transform.position.y, PlayerNumAry[0].transform.position.z) + transform.right * -77f; //transform.position + transform.right * -2.5f + transform.up * -0.4f + transform.forward * -0.2f;
                        //PlayerNumAry[1].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[1].transform.position.y, PlayerNumAry[1].transform.position.z) + transform.right * 77f; //transform.position + transform.right * 2.5f + transform.up * -0.4f + transform.forward * -0.2f;
                        LayoutGroupCpnt.spacing = -280;
                        break;

                    case 3:
                        //PlayerNumAry[0].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[0].transform.position.y, PlayerNumAry[0].transform.position.z) + transform.right * -122f; //transform.position + transform.right * -3.2f + transform.up * -0.4f + transform.forward * -0.2f;
                        //PlayerNumAry[1].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[1].transform.position.y, PlayerNumAry[1].transform.position.z); //transform.position + transform.right * 0.0f + transform.up * -0.4f + transform.forward * -0.2f;
                        //PlayerNumAry[2].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[2].transform.position.y, PlayerNumAry[2].transform.position.z) + transform.right * 122; //transform.position + transform.right * 3.2f + transform.up * -0.4f + transform.forward * -0.2f;
                        LayoutGroupCpnt.spacing = -140;
                        break;

                    case 4:
                        //PlayerNumAry[0].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[0].transform.position.y, PlayerNumAry[0].transform.position.z) + transform.right * -158f; //transform.position + transform.right * -4.2f + transform.up * -0.4f + transform.forward * -0.2f;
                        //PlayerNumAry[1].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[1].transform.position.y, PlayerNumAry[1].transform.position.z) + transform.right * -54f; //transform.position + transform.right * -1.4f + transform.up * -0.4f + transform.forward * -0.2f;
                        //PlayerNumAry[2].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[2].transform.position.y, PlayerNumAry[2].transform.position.z) + transform.right * 54f; //transform.position + transform.right * 1.4f + transform.up * -0.4f + transform.forward * -0.2f;
                        //PlayerNumAry[3].transform.position = new Vector3(PlayerMappingNumsGO.transform.position.x, PlayerNumAry[3].transform.position.y, PlayerNumAry[3].transform.position.z) + transform.right * 158f; //transform.position + transform.right * 4.2f + transform.up * -0.4f + transform.forward * -0.2f;
                        LayoutGroupCpnt.spacing = 0;
                        break;
                    }
                }

                if (CloseButton != null)
                {                 //Player人数が変わった際にCloseボタンからの右移動で右端のPlayerNumに選択が移動するように設定する
                    if (1 <= SetScript.PlayerNum && SetScript.PlayerNum <= 4)
                    {
                        LastNumberPlayerButton = PlayerNumAry[SetScript.PlayerNum - 1].GetComponent <Button>();
                    }
                    else
                    {
                        LastNumberPlayerButton = null;
                    }
                    if (LastNumberPlayerButton != null)
                    {
                        if (CloseButton.navigation.mode == Navigation.Mode.Explicit)
                        {
                            //Navigation TempNav = new Navigation ();
                            //TempNav.mode = Navigation.Mode.Explicit;
                            Navigation TempNav = CloseButton.navigation;
                            TempNav.selectOnRight  = LastNumberPlayerButton;
                            CloseButton.navigation = TempNav;
                            EditorUtility.SetDirty(CloseButton);
                        }
                    }
                }
                PlayerNum = SetScript.PlayerNum;
            }
        }
    }
Exemplo n.º 25
0
    void Awake()
    {
        if (SetScript == null)
        {
            SetScript = GetComponentInParent <jInputSettings>();
        }
        if (SetScript == null)
        {
            Debug.LogError("[jInput] jInputSettings script is Not Found!!");
        }
        else
        {
            if (1 <= SetScript.PlayerNum && SetScript.PlayerNum <= 4)
            {
                PlayerNum = SetScript.PlayerNum;
            }
            else
            {
                PlayerNum = 4;
            }
        }

        PreyerNumTextMeshes = new TextMesh[PlayerNum + 1];         //[0] is empty all time
        bool[] MappingNumChecks = new bool[PlayerNum + 1];         //[0] is empty all time
        if (PlayerNum != 4)
        {
            if (MappingNumObjects == null && transform.Find("PlayerMappingNums"))
            {
                MappingNumObjects = transform.Find("PlayerMappingNums").gameObject;
            }
            if (MappingNumObjects != null)
            {
                DestroyImmediate(MappingNumObjects);
            }
        }
        if (PlayerNum != 1)
        {
            if (transform.Find("PlayerMappingNums"))
            {
                MappingNumObjects = transform.Find("PlayerMappingNums").gameObject;
            }
            else
            {
                MappingNumObjects      = new GameObject();
                MappingNumObjects.name = "PlayerMappingNums";
                MappingNumObjects.AddComponent <PlayerMappingNums>();
                MappingNumObjects.transform.SetParent(transform);
            }
            for (int i = 1; i <= PlayerNum; i++)
            {
                for (int j = 0; j < MappingNumObjects.transform.childCount; j++)
                {
                    GameObject TempChild = MappingNumObjects.transform.GetChild(j).gameObject;
                    if (TempChild.name == "Player" + i + "MappingNum")
                    {
                        if (MappingNumChecks[i])
                        {
                            DestroyImmediate(TempChild);
                        }
                        else
                        {
                            MappingNumChecks[i] = true;
                            TextObject          = TempChild;
                        }
                    }
                }
                if (MappingNumChecks[i] != true)
                {
                    TextObject      = Instantiate(NumPrefab) as GameObject;
                    TextObject.name = "Player" + i + "MappingNum";
                    TextObject.transform.SetParent(MappingNumObjects.transform);
#if (UNITY_EDITOR)
                    TextObject.hideFlags = HideFlags.HideInHierarchy;                    //.NotEditable;
#endif
                }
                TextObject.GetComponent <PlayerMappingNumHold>().PlayerMappingNumber = i;
                PreyerNumTextMeshes[i]      = TextObject.transform.Find("Number").GetComponent <TextMesh>();
                PreyerNumTextMeshes[i].text = i.ToString();

                switch (PlayerNum)
                {
                case 1:
                    break;

                case 2:
                    if (i == 1)
                    {
                        TextObject.transform.position = transform.position + transform.right * -2.5f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    if (i == 2)
                    {
                        TextObject.transform.position = transform.position + transform.right * 2.5f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    break;

                case 3:
                    if (i == 1)
                    {
                        TextObject.transform.position = transform.position + transform.right * -3.2f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    if (i == 2)
                    {
                        TextObject.transform.position = transform.position + transform.right * 0.0f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    if (i == 3)
                    {
                        TextObject.transform.position = transform.position + transform.right * 3.2f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    break;

                case 4:
                    if (i == 1)
                    {
                        TextObject.transform.position = transform.position + transform.right * -4.2f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    if (i == 2)
                    {
                        TextObject.transform.position = transform.position + transform.right * -1.4f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    if (i == 3)
                    {
                        TextObject.transform.position = transform.position + transform.right * 1.4f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    if (i == 4)
                    {
                        TextObject.transform.position = transform.position + transform.right * 4.2f + transform.up * -0.4f + transform.forward * -0.2f;
                    }
                    break;
                }
            }
            PlayerColorSetting();
        }
    }