예제 #1
0
        int GetListIDFromPerkID(int ID)
        {
            List <Perk> perkList = EditorDBManager.GetPerkList();

            for (int i = 0; i < perkList.Count; i++)
            {
                if (perkList[i].ID == ID)
                {
                    return(i);
                }
            }
            return(0);
        }
예제 #2
0
        private static void GetPerk()
        {
            EditorDBManager.Init();

            perkList = EditorDBManager.GetPerkList();

            if (Application.isPlaying)
            {
                return;
            }

            List <int> perkIDList = EditorDBManager.GetPerkIDList();

            for (int i = 0; i < instance.unavailableIDList.Count; i++)
            {
                if (!perkIDList.Contains(instance.unavailableIDList[i]))
                {
                    instance.unavailableIDList.RemoveAt(i); i -= 1;
                }
            }
        }
예제 #3
0
        void OnGUI()
        {
            if (window == null)
            {
                Init();
            }

            List <Perk> perkList = EditorDBManager.GetPerkList();

            if (GUI.Button(new Rect(window.position.width - 120, 5, 100, 25), "Save"))
            {
                EditorDBManager.SetDirtyPerk();
            }


            if (GUI.Button(new Rect(5, 5, 120, 25), "Create New"))
            {
                int newSelectID = EditorDBManager.AddNewPerk();
                if (newSelectID != -1)
                {
                    SelectPerk(newSelectID);
                }
            }
            if (perkList.Count > 0 && GUI.Button(new Rect(130, 5, 100, 25), "Clone Selected"))
            {
                int newSelectID = EditorDBManager.ClonePerk(selectID);
                if (newSelectID != -1)
                {
                    SelectPerk(newSelectID);
                }
            }


            float startX = 5;
            float startY = 55;


            if (minimiseList)
            {
                if (GUI.Button(new Rect(startX, startY - 20, 30, 18), ">>"))
                {
                    minimiseList = false;
                }
            }
            else
            {
                if (GUI.Button(new Rect(startX, startY - 20, 30, 18), "<<"))
                {
                    minimiseList = true;
                }
            }
            Vector2 v2 = DrawPerkList(startX, startY, perkList);

            startX = v2.x + 25;

            if (perkList.Count == 0)
            {
                return;
            }


            Rect visibleRect = new Rect(startX, startY, window.position.width - startX - 10, window.position.height - startY - 5);
            Rect contentRect = new Rect(startX, startY, contentWidth - startY, contentHeight);

            scrollPos2 = GUI.BeginScrollView(visibleRect, scrollPos2, contentRect);

            //float cachedX=startX;
            v2            = DrawPerkConfigurator(startX, startY, perkList[selectID]);
            contentWidth  = v2.x + 50;
            contentHeight = v2.y - 55;

            GUI.EndScrollView();


            if (GUI.changed)
            {
                EditorDBManager.SetDirtyPerk();
            }
        }
예제 #4
0
 int GetPerkIDFromListID(int ID)
 {
     return(EditorDBManager.GetPerkList()[ID].ID);
 }
예제 #5
0
 private static void GetPerk()
 {
     EditorDBManager.Init();
     perkList = EditorDBManager.GetPerkList();
 }
예제 #6
0
        public override void OnInspectorGUI()
        {
            cont = new GUIContent("Assign Item Manually:", "Check to manually assign the item and their associate perk");
            instance.assignItemManually = EditorGUILayout.Toggle(cont, instance.assignItemManually);

            if (instance.assignItemManually)
            {
                GUILayout.BeginHorizontal();
                //EditorGUILayout.Space();
                if (GUILayout.Button("Add Item", GUILayout.MaxWidth(120)))
                {
                    //AddItem();
                    instance.itemList.Add(new UIPerkMenu.PerkItem());
                }
                if (GUILayout.Button("Reduce Item", GUILayout.MaxWidth(120)))
                {
                    //RemoveItem();
                    instance.itemList.RemoveAt(instance.itemList.Count - 1);
                }
                GUILayout.EndHorizontal();

                EditorGUILayout.Space();

                string[]    perkNameList = EditorDBManager.GetPerkNameList();
                List <Perk> perkList     = EditorDBManager.GetPerkList();
                int[]       intList      = new int[perkNameList.Length];
                for (int i = 0; i < perkNameList.Length; i++)
                {
                    if (i == 0)
                    {
                        intList[i] = -1;
                    }
                    else
                    {
                        intList[i] = perkList[i - 1].ID;
                    }
                }

                for (int i = 0; i < instance.itemList.Count; i++)
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.Label(" - Element " + (i + 1), GUILayout.Width(75));

                    instance.itemList[i].button.rootObj = (GameObject)EditorGUILayout.ObjectField(instance.itemList[i].button.rootObj, typeof(GameObject), true);

                    //~ if(GUILayout.Button("+", GUILayout.MaxWidth(20))){
                    //~ InsertWaypoints(i);
                    //~ }
                    //~ if(GUILayout.Button("-", GUILayout.MaxWidth(20))){
                    //~ i-=RemoveWaypoints(i);
                    //~ }
                    GUILayout.EndHorizontal();


                    GUILayout.BeginHorizontal();
                    GUILayout.Label("    Link   ", GUILayout.Width(75));
                    instance.itemList[i].linkObj = (GameObject)EditorGUILayout.ObjectField(instance.itemList[i].linkObj, typeof(GameObject), true);
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("    Label:   ", GUILayout.Width(75));
                    instance.itemList[i].perkID = EditorGUILayout.IntPopup(instance.itemList[i].perkID, perkNameList, intList);
                    GUILayout.EndHorizontal();

                    EditorGUILayout.Space();
                }
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("", GUILayout.MaxWidth(10));
            showDefaultFlag = EditorGUILayout.Foldout(showDefaultFlag, "Show default editor");
            EditorGUILayout.EndHorizontal();
            if (showDefaultFlag)
            {
                DrawDefaultInspector();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(instance);
            }
        }