Beispiel #1
0
        void DisplayButtons()
        {
            if (!showDetails)
            {
                if (GUILayout.Button("Add Object"))
                {
                    if (EditingWeapons)
                    {
                        TempWeapon = new ISWeapon();
                    }
                    if (About)
                    {
                        Debug.Log("This creates a temporary item press teh save button to permanently add it to you database.");
                    }
                    showDetails = true;
                }
            }
            else
            {
                if (GUILayout.Button("Save"))
                {
                    if (EditingWeapons)
                    {
                        for (int i = 0; i < WeaponDB.Count; i++)
                        {
                            if (TempWeapon.ISName == WeaponDB.Get(i).ISName)
                            {
                                QDB = ISQualityDatabase.GetDatabase <ISQualityDatabase>(QUALITY_DATABASE_PATH, QUALITY_DATABASE_NAME);
                                TempWeapon.ISQuality = QDB.Get(TempWeapon.qualitySelectedID);
                                WeaponDB.Replace(i, TempWeapon);
                                showDetails = false;
                                TempWeapon  = null;
                            }
                        }
                        Debug.Log("weapon saved");

                        QDB = ISQualityDatabase.GetDatabase <ISQualityDatabase>(QUALITY_DATABASE_PATH, QUALITY_DATABASE_NAME);
                        TempWeapon.ISQuality = QDB.Get(TempWeapon.qualitySelectedID);
                        WeaponDB.Add(TempWeapon);
                        showDetails = false;
                        TempWeapon  = null;
                    }
                }

                if (GUILayout.Button("Cancel"))
                {
                    Debug.Log("weapon canceled");
                    showDetails = false;
                    TempWeapon  = null;
                }
            }
        }
Beispiel #2
0
 void ListView()
 {
     _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos, "Box", GUILayout.ExpandHeight(true), GUILayout.Width(_listViewWidth));
     //  GUILayout.Label("TEST");
     if (EditingWeapons)
     {
         if (WeaponDB.Count > 0)
         {
             for (int i = 0; i < WeaponDB.Count; i++)
             {
                 GUILayout.BeginHorizontal();
                 if (GUILayout.Button(WeaponDB.Get(i).ISName))
                 {
                     TempWeapon  = WeaponDB.Get(i);
                     showDetails = true;
                 }
                 if (GUILayout.Button("X"))
                 {
                     WeaponDB.RemoveAt(i);
                 }
                 GUILayout.EndHorizontal();
             }
         }
         else
         {
             if (GUILayout.Button("No Items in the database add one now"))
             {
                 TempWeapon  = new ISWeapon();
                 showDetails = true;
             }
         }
     }
     if (EditingArmor)
     {
         GUILayout.Label("Not Created Yet");
     }
     if (About)
     {
         GUILayout.Label("This is the list view. All the items in the Database will apear here. To view the items stats click it. To delete it you can click hte cross.");
     }
     GUILayout.EndScrollView();
 }