Exemplo n.º 1
0
    protected void OnGUI()
    {
        if (my != null)
        {
            if (my.Items == null)
            {
                my.Items = new List <CollectorDatabase.ItemGet>();
            }
            GUILayout.BeginVertical("box");
            GUILayout.Label("" + titleContent.text, center);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            Save();
            GUILayout.EndHorizontal();
            Multiplers();
            VariantSlider(my);
            EditorFunctions.CheckList(my.Items, items.Components);
            ItemsPanel(my);
            GUILayout.EndVertical();
            ItemsList(my);
        }
        else
        {
            Close();
        }

        if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Mouse1))
        {
            GUI.FocusControl(null);
        }
    }
Exemplo n.º 2
0
    void StatePanel(List <int> currentList, string title)
    {
        StateDataBase StateData = (StateDataBase)AssetDatabase.LoadAssetAtPath("Assets/DataBase/Data_States.asset", typeof(StateDataBase));

        GUILayout.BeginVertical("box");
        GUILayout.Label(title, center);
        GUILayout.EndVertical();
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        scrollAdd = GUILayout.BeginScrollView(scrollAdd, GUILayout.Height(200), GUILayout.Width(230));
        GUILayout.BeginVertical("box", GUILayout.Width(200));
        GUILayout.Label("Add", center);
        StateList(currentList, StateData.States);
        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        GUILayout.Space(20);
        scrollRemove = GUILayout.BeginScrollView(scrollRemove, GUILayout.Height(200), GUILayout.Width(230));
        GUILayout.BeginVertical("box", GUILayout.Width(200));
        GUILayout.Label("Remove", center);
        EditorFunctions.CheckList(currentList, StateData.States);
        for (int i = 0; i < currentList.Count; i++)
        {
            if (GUILayout.Button("" + StateData.States[currentList[i]].Name))
            {
                currentList.RemoveAt(i);
            }
        }
        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
    }
Exemplo n.º 3
0
 void ComponentsPanel(List <IComponent> currentList)
 {
     GUILayout.BeginVertical("box");
     GUILayout.Label("Components", center);
     GUILayout.EndVertical();
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     GUILayout.BeginVertical("box", GUILayout.Width(300));
     scrollAdd = GUILayout.BeginScrollView(scrollAdd, GUILayout.Height(200));
     GUILayout.Label("Add", center);
     ComponentList(currentList);
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
     GUILayout.Space(20);
     GUILayout.BeginVertical("box", GUILayout.Width(300));
     scrollRemove = GUILayout.BeginScrollView(scrollRemove, GUILayout.Height(200));
     GUILayout.Label("Remove", center);
     if (currentList.Count >= 8)
     {
         GUILayout.Label("Max Components!");
     }
     EditorFunctions.CheckList(currentList, my.Components);
     for (int i = 0; i < currentList.Count; i++)
     {
         GUILayout.BeginHorizontal("box");
         if (GUILayout.Button("" + my.Components[currentList[i].ID].Name, GUILayout.Width(100)))
         {
             currentList.RemoveAt(i); break;
         }
         currentList[i].amount = EditorGUILayout.IntSlider(currentList[i].amount, 1, 9999);
         GUILayout.EndHorizontal();
     }
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
 }
Exemplo n.º 4
0
    void ComponentsPanel(List <IComponent> currentList)
    {
        GUILayout.BeginVertical("box");
        GUILayout.Label("Components", center);
        GUILayout.EndVertical();
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical("box", GUILayout.Width(300));
        scrollAdd = GUILayout.BeginScrollView(scrollAdd, GUILayout.Height(200));
        GUILayout.Label("Add", center);
        ComponentsList();
        GUILayout.EndScrollView();
        GUILayout.EndVertical();
        GUILayout.Space(10);
        GUILayout.BeginVertical("box", GUILayout.Width(300));
        scrollRemove = GUILayout.BeginScrollView(scrollRemove, GUILayout.Height(200));
        GUILayout.Label("Remove", center);
        if (currentList.Count >= 8)
        {
            GUILayout.Label("Max Components!");
        }
        EditorFunctions.CheckList(currentList, items.Components);
        for (int i = 0; i < currentList.Count; i++)
        {
            GUILayout.BeginHorizontal("box");
            if (GUILayout.Button("" + items.Components[currentList[i].ID].Name, GUILayout.Width(100)))
            {
                currentList.RemoveAt(i); break;
            }
            currentList[i].amount = EditorGUILayout.IntSlider(currentList[i].amount, 1, 9999);
            GUILayout.EndHorizontal();
        }
        GUILayout.EndScrollView();
        GUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();


        void ComponentsList()
        {
            for (int i = 0; i < items.Components.Count; i++)
            {
                bool has = false;
                for (int j = 0; j < currentList.Count; j++)
                {
                    if (i == currentList[j].ID)
                    {
                        has = true;
                        break;
                    }
                }
                if (!has)
                {
                    if (GUILayout.Button("" + items.Components[i].Name) && currentList.Count < 8)
                    {
                        currentList.Add(new IComponent(i, ItemCategory.Component));
                    }
                }
            }
        }
    }