void DisplayButtons() { if (!showNewWeaponDetails) { if (GUILayout.Button("Create Weapon")) { tempWeapon = new ISWeapon(); showNewWeaponDetails = true; } } else { if (GUILayout.Button("Save")) { showNewWeaponDetails = false; // string DATABASE_NAME = @"eiaQualityDatabase.asset"; // string DATABASE_PATH = @"Database"; // ISQualityDatabase qdb; // qdb = ISQualityDatabase.GetDatabase<ISQualityDatabase>(DATABASE_PATH, DATABASE_NAME); // // tempWeapon.Quality = qdb.Get(tempWeapon.SelectedQualityID); database.Add(tempWeapon); tempWeapon = null; } if (GUILayout.Button("Cancel")) { showNewWeaponDetails = false; tempWeapon = null; } } }
void DisplayButton() { if (!toggleNewWeaponDetails) { if (GUILayout.Button("Create New Weapon")) { tempWeapon = new ISWeapon(); toggleNewWeaponDetails = true; } } else { if (GUILayout.Button("Save")) { toggleNewWeaponDetails = false; database.Add(tempWeapon); tempWeapon = null; } if (GUILayout.Button("Cancel")) { toggleNewWeaponDetails = true; tempWeapon = null; } } }
void DisplayButtons() { if(!showNewWeaponDetails) { if (GUILayout.Button("Create Weapon")) { tempWeapon = new ISWeapon(); showNewWeaponDetails = true; } } else { if (GUILayout.Button("Save")) { showNewWeaponDetails = false; // string Database_Name = @"ShrekanQualityDatabase.asset"; // string Database_Path = @"Database"; // ISQualityDatabase qdb; // qdb = ISQualityDatabase.GetDatabase<ISQualityDatabase>(Database_Path, Database_Name); // // tempWeapon.Quality = qdb.Get(tempWeapon.SelectedQualityID); database.Add( tempWeapon ); tempWeapon = null; } if (GUILayout.Button("Cancel")) { showNewWeaponDetails = false; tempWeapon = null; } } }
void ViewWeapon(ISWeapon tempWeapon) { ViewCommonItem (tempWeapon); EditorGUILayout.LabelField("Min Damage", tempWeapon.MinDamage.ToString()); EditorGUILayout.LabelField("Max Damage", tempWeapon.MaxDamage.ToString()); EditorGUILayout.LabelField("Max Durability", tempWeapon.MaxDurability.ToString()); DisplayWeaponType (false, tempWeapon); GUILayout.BeginHorizontal (); if(tempWeapon.TwoHanded) { EditorGUILayout.LabelField("Attack type", "Two-handed " + DisplayAttackType (false, tempWeapon)); } else { EditorGUILayout.LabelField("Attack type", "One-handed " + DisplayAttackType (false, tempWeapon)); } GUILayout.EndHorizontal (); if(_tempWeapon.Ranged) { EditorGUILayout.LabelField("Range", tempWeapon.Range.ToString()); } if(_tempWeapon.Prefab == null) { EditorGUILayout.LabelField ("Prefab", "Empty"); } else { EditorGUILayout.LabelField ("Prefab", tempWeapon.Prefab.name); } }
void EditWeapon(ISWeapon tempWeapon) { EditCommonItem (tempWeapon); tempWeapon.MinDamage = EditorGUILayout.IntField("Min Damage", tempWeapon.MinDamage); if(tempWeapon.MinDamage < 0) tempWeapon.MinDamage = 0; tempWeapon.MaxDamage = EditorGUILayout.IntField("Max Damage", tempWeapon.MaxDamage); if(tempWeapon.MaxDamage < 0) tempWeapon.MaxDamage = 0; tempWeapon.MaxDurability = EditorGUILayout.IntField("Max Durability", tempWeapon.MaxDurability); if(tempWeapon.MaxDurability < 1) tempWeapon.MaxDurability = 1; DisplayWeaponType (true, tempWeapon); DisplayAttackType (true, tempWeapon); tempWeapon.TwoHanded = EditorGUILayout.Toggle("Two-Handed weapon?", tempWeapon.TwoHanded); tempWeapon.Ranged = EditorGUILayout.Toggle("Ranged weapon?", tempWeapon.Ranged); if(tempWeapon.Ranged) { tempWeapon.Range = EditorGUILayout.IntField("Range", tempWeapon.Range); if(tempWeapon.Range < 1) tempWeapon.Range = 1; } tempWeapon.Prefab = EditorGUILayout.ObjectField ("Prefab", tempWeapon.Prefab, typeof(GameObject), false) as GameObject; }
void DisplayButtons() { if (!showNewWeapon) { if (GUILayout.Button("Create Weapon")) { tempWeapon = new ISWeapon(); showNewWeapon = true; State = DisplyState.WEAPONDETAILS; } } else { GUI.SetNextControlName("SaveButton"); if (GUILayout.Button("Save")) { if (_selectedIndex == -1) { database.Add(tempWeapon); } else { database.Replace(_selectedIndex, tempWeapon); } showNewWeapon = false; // item.Add(tempWeapon); tempWeapon = null; _selectedIndex = -1; State = DisplyState.NONE; GUI.FocusControl("SaveButton"); } if (_selectedIndex != -1) { if (GUILayout.Button("Delete")) { if (EditorUtility.DisplayDialog("Delete" + database.Get(_selectedIndex).Name + "?", "Do you want to Delete " + database.Get(_selectedIndex).Name + " from the data?", "Delete (Yes)", "Cancel (no)")) { database.Remove(_selectedIndex); showNewWeapon = false; tempWeapon = null; _selectedIndex = -1; State = DisplyState.NONE; GUI.FocusControl("SaveButton"); } } } if (GUILayout.Button("Cancel")) { showNewWeapon = false; tempWeapon = null; _selectedIndex = -1; State = DisplyState.NONE; GUI.FocusControl("SaveButton"); } } }
string DisplayAttackType(bool isModifiable, ISWeapon tempWeapon) { string returnString = ""; if(!_attackTypeOptionsLoaded && isModifiable) { return null; } int itemIndex = 0; if(tempWeapon.AttackType != null) { itemIndex = _attackTypeDatabase.GetIndex(tempWeapon.AttackType.Name); } if(itemIndex == -1) { itemIndex = 0; } if(isModifiable) { _attackTypeSelectedIndex = EditorGUILayout.Popup ("Attack Type", itemIndex, _attackTypeOptions); tempWeapon.AttackType = _attackTypeDatabase.Get (_attackTypeSelectedIndex); } else { returnString = tempWeapon.AttackType.Name.ToString(); } return returnString; }
void DisplayButtons() { if (!showNewWeaponDetails) { if (GUILayout.Button(" Create Weapon")) { tempWeapon = new ISWeapon(); Debug.Log("Create new Weapon"); showNewWeaponDetails = true; } } else { if (GUILayout.Button("Save")) { Debug.Log("Save"); showNewWeaponDetails = false; tempWeapon = null; } if (GUILayout.Button("Cancel")) { Debug.Log("Cancel"); showNewWeaponDetails = false; tempWeapon = null; } } }
void DisplayButtons() { if (!ShowNewWeaponDetails) { if (GUILayout.Button("Create Weapon")) { tempWeapon = new ISWeapon(); ShowNewWeaponDetails = true; state = DisplayState.DETAILS; } } else { GUI.SetNextControlName("SaveButton"); if (GUILayout.Button("Save")) { if(_selectedIndex == -1) database.Add(tempWeapon); else database.Replace(_selectedIndex, tempWeapon); ShowNewWeaponDetails = false; tempWeapon = null; _selectedIndex = -1; state = DisplayState.NONE; GUI.FocusControl("SaveButton"); } if(_selectedIndex != -1) { if (GUILayout.Button("Delete")) { if (EditorUtility.DisplayDialog("Delete Weapon", "Are you sure that you want to delete " + database.Get(_selectedIndex).Name + " from the database?", "Delete", "Cancel")) { database.Remove(_selectedIndex); ShowNewWeaponDetails = false; tempWeapon = null; _selectedIndex = -1; state = DisplayState.NONE; GUI.FocusControl("DeleteButton"); } } } if (GUILayout.Button("Cancel")) { ShowNewWeaponDetails = false; tempWeapon = null; _selectedIndex = -1; state = DisplayState.NONE; GUI.FocusControl("CancelButton"); } } }
bool IsWeaponFormComplete(ISWeapon tempWeapon) { IsItemFormComplete (tempWeapon); if(tempWeapon.InventorySprite == null) { EditorUtility.DisplayDialog("Weapon not given an inventory sprite", "You must give the weapon an inventory sprite before saving.", "Okay"); return false; } return true; }
void Update() { Time.timeScale = 1; ISWeapon W1 = WDB.Get(cnt1); X1 = W1.Name; ISWeapon W2 = WDB.Get(cnt2); X2 = W2.Name; ISWeapon W3 = WDB.Get(cnt3); X3 = W3.Name; // if (Input.GetMouseButtonDown (0)) { // Instantiate (x, MenuCubes.cube_pos.position, MenuCubes.cube_pos.rotation); // } }
void Spawn(int index) { ISWeapon isw = database.Get(index); GameObject weapon = Instantiate(isw.Prefab); weapon.name = isw.Name; Weapon myWeapon = weapon.AddComponent <Weapon>(); myWeapon.Icon = isw.Icon; myWeapon.Value = isw.Value; myWeapon.Quality = isw.Quality.Icon; myWeapon.MinDamage = isw.MinDamage; myWeapon.MaxDurabilty = isw.MaxDurability; myWeapon.Durability = isw.Durability; // myWeapon.EquipmentSlot = isw.Equipment_Slot; myWeapon.Equipment_Slot = isw.equipmentSlot; }
void ListView() { if(state != DisplayState.NONE) return; _scrollPos = GUILayout.BeginScrollView(_scrollPos, "Box", GUILayout.ExpandHeight(true), GUILayout.Width(_listViewWidth)); for(int cnt = 0; cnt < database.Count; cnt++) { if(GUILayout.Button(database.Get(cnt).Name, "box", GUILayout.Width(_listViewButtonWidth), GUILayout.Height(_listViewButtonHeight))) { _selectedIndex = cnt; tempWeapon = new ISWeapon(database.Get(cnt)); ShowNewWeaponDetails = true; state = DisplayState.DETAILS; } } GUILayout.EndScrollView(); }
void ListView() { if (state != DisplayState.NONE) { return; //dont show the rest of the things in listView } _scrollPos = GUILayout.BeginScrollView(_scrollPos, "Box", GUILayout.ExpandHeight(true), GUILayout.Width(_listViewWidth)); for (int cnt = 0; cnt < database.Count; cnt++) { if (GUILayout.Button(database.Get(cnt).Name, "box", GUILayout.Width(_listWiewButtonWidth), GUILayout.Height(_listWiewButtonHeight))) { _selectedIndex = cnt; tempWeapon = new ISWeapon(database.Get(cnt)); showNewWeaponDetails = true; state = DisplayState.DETAILS; } } GUILayout.EndScrollView(); }
public static void Loot(int id) { bool wep = false; int y = 6; // for (int cnt = 0; cnt < x; cnt++) { // GUILayout.BeginHorizontal (); if (!wep) { if (GUILayout.Button(PauseMenu.WDB.Get(TreasureChest.W_ItemID).Name)) { ISWeapon isw = PauseMenu.WDB.Get(TreasureChest.W_ItemID); Weapon Wep = new Weapon(); Wep.Name = isw.Name; Wep.ItemID = TreasureChest.W_ItemID; Wep.Burden = isw.ISBurden; Wep.Equipment_Slot = isw.EquipmentSlot; Wep.Min_Damage = isw.MinDamage; Wep.Durability = isw.Durability; Wep.Max_Durability = isw.MaxDurability; Wep.Value = isw.ISValue; Wep.Equipment_Element = isw.EQElement; Wep.Equipment_Type = isw.EquipmentType; Wep.Equipment_Range = isw.EquipmentRange; GameInformation.InventoryWeapons.Add(Wep); wep = true; } } GUILayout.Button(PauseMenu.ADB.Get(TreasureChest.A_ItemID).Name); GUILayout.Button(PauseMenu.PDB.Get(TreasureChest.P_ItemID).Name); // }GUILayout.EndHorizontal ();} if (GUILayout.Button("X")) { loot_enabled = false; wep = false; } GUI.DragWindow(); }
void ListView() { if (State != DisplyState.NONE) { return; } _scrollPos = GUILayout.BeginScrollView(_scrollPos, "Box", GUILayout.ExpandHeight(true), GUILayout.Width(_listViewWidth)); for (int i = 0; i < database.Count; i++) { if (GUILayout.Button(database.Get(i).Name, "box", GUILayout.Width(_listViewWidth - 10))) { _selectedIndex = i; tempWeapon = new ISWeapon(database.Get(i)); showNewWeapon = true; State = DisplyState.WEAPONDETAILS; } } EditorGUILayout.EndScrollView(); }
void DisplayButtons() { if (!showNewWeaponDetails) { if (GUILayout.Button("Create Weapon")) { tempWeapon = new ISWeapon(); showNewWeaponDetails = true; state = DisplayState.DETAILS; } } else { GUI.SetNextControlName("Save Button"); if (GUILayout.Button("Save")) { if (_selectedIndex == -1) { database.Add(tempWeapon); } else { database.Replace(_selectedIndex, tempWeapon); } showNewWeaponDetails = false; tempWeapon = null; _selectedIndex = -1; state = DisplayState.NONE; GUI.FocusControl("Save Button"); } if (_selectedIndex != -1) { if (GUILayout.Button("Delete")) { if (EditorUtility.DisplayDialog("Delete Weapon", "Are you sure you want to delete " + database.Get(_selectedIndex).Name + " from the database", "Delete", "Cancel")) { database.Remove(_selectedIndex); showNewWeaponDetails = false; tempWeapon = null; _selectedIndex = -1; state = DisplayState.NONE; GUI.FocusControl("Save Button"); } } } if (GUILayout.Button("Cancel")) { showNewWeaponDetails = false; tempWeapon = null; _selectedIndex = -1; state = DisplayState.NONE; GUI.FocusControl("Save Button"); } } }
void OnGUI() { GUI.skin = StyleTest; GUILayout.BeginArea(new Rect(Screen.width / 2, Screen.height / 6, Screen.width / 6, Screen.height / 2), "-", "Box"); GUILayout.Label("MainMenu"); if (BGUIEnabled) { if (GUILayout.Button("NewGame")) { MGUIEnabled = true; BGUIEnabled = false; } } if (MGUIEnabled) { Name = GUILayout.TextField(Name, 20); if (GUILayout.Button("Start")) { NewGame = true; GameInformation.Stat_Points = Alloted_points; newPlayer.PlayerLevel = 1; newPlayer.RequiredXp = 100; newPlayer.PlayerName = Name; GameInformation.Max_Expertise_Points = 1500; for (int cnt = 0; cnt < 3; cnt++) { ISWeapon isw = WDB.Get(cnt); Weapon myweapon = new Weapon(); myweapon.ItemID = cnt; myweapon.Name = isw.Name; myweapon.Burden = isw.ISBurden; myweapon.Equipment_Slot = isw.EquipmentSlot; myweapon.Min_Damage = isw.MinDamage; myweapon.Durability = isw.Durability; myweapon.Max_Durability = isw.MaxDurability; myweapon.Value = isw.ISValue; myweapon.Equipment_Element = isw.EQElement; myweapon.Equipment_Type = isw.EquipmentType; myweapon.Equipment_Range = isw.EquipmentRange; GameInformation.InventoryWeapons.Add(myweapon); } Store(); // Debug.Log ("PlayerClass" + newPlayer.PlayerClass.CharacterClassName); CameraManipulation.pause = false; Application.LoadLevel("SchoolLevel"); } GUILayout.Label("Alloted Points : " + Alloted_points); GUILayout.BeginVertical( ); if (Alloted_points > 0) { GUILayout.BeginHorizontal( ); GUILayout.Label("Vitality : " + newPlayer.Vitality); if (GUILayout.Button("+")) { newPlayer.Vitality++; Alloted_points--; } if (GUILayout.Button("-")) { if (newPlayer.Vitality > 0) { newPlayer.Vitality--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Endurance : " + newPlayer.Endurance); if (GUILayout.Button("+")) { newPlayer.Endurance++; Alloted_points--; } if (GUILayout.Button("-")) { if (newPlayer.Endurance > 0) { newPlayer.Endurance--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Dexetry : " + newPlayer.Dexetry); if (GUILayout.Button("+")) { newPlayer.Dexetry++; Alloted_points--; } if (GUILayout.Button("-")) { if (newPlayer.Dexetry > 0) { newPlayer.Dexetry--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Intellect : " + newPlayer.Intellect); if (GUILayout.Button("+")) { newPlayer.Intellect++; Alloted_points--; } if (GUILayout.Button("-")) { if (newPlayer.Intellect > 0) { newPlayer.Intellect--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Strenght : " + newPlayer.Strength); if (GUILayout.Button("+")) { newPlayer.Strength++; Alloted_points--; } if (GUILayout.Button("-")) { if (newPlayer.Strength > 0) { newPlayer.Strength--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Aim : " + newPlayer.Aim); if (GUILayout.Button("+")) { newPlayer.Aim++; Alloted_points--; } if (GUILayout.Button("-")) { if (newPlayer.Aim > 0) { newPlayer.Aim--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.BeginVertical( ); if (Alloted_points == 0) { GUILayout.BeginHorizontal( ); GUILayout.Label("Vitality : " + newPlayer.Vitality); if (GUILayout.Button("-")) { if (newPlayer.Vitality > 0) { newPlayer.Vitality--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Endurance : " + newPlayer.Endurance); if (GUILayout.Button("-")) { if (newPlayer.Endurance > 0) { newPlayer.Endurance--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Dexetry : " + newPlayer.Dexetry); if (GUILayout.Button("-")) { if (newPlayer.Dexetry > 0) { newPlayer.Dexetry--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Intellect : " + newPlayer.Intellect); if (GUILayout.Button("-")) { if (newPlayer.Intellect > 0) { newPlayer.Intellect--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Strength : " + newPlayer.Strength); if (GUILayout.Button("-")) { if (newPlayer.Strength > 0) { newPlayer.Strength--; Alloted_points++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Aim : " + newPlayer.Aim); if (GUILayout.Button("-")) { if (newPlayer.Aim > 0) { if (newPlayer.Aim > 0) { newPlayer.Aim--; Alloted_points++; } } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } GUILayout.BeginHorizontal(); // for (int cnt = 0; cnt < 3; cnt++) { // ISWeapon isw = WDB.Get (cnt); // Weapon myweapon = new Weapon (); // myweapon.ItemID = cnt; // myweapon.Name = isw.Name; // myweapon.Burden = isw.ISBurden; // myweapon.Equipment_Slot = isw.EquipmentSlot; // myweapon.Min_Damage = isw.MinDamage; // myweapon.Durability = isw.Durability; // myweapon.Max_Durability = isw.MaxDurability; // myweapon.Value = isw.ISValue; // myweapon.Equipment_Element = isw.EQElement; // myweapon.Equipment_Type = isw.EquipmentType; // myweapon.Equipment_Range = isw.EquipmentRange; // GameInformation.InventoryWeapons.Add (myweapon); // } GUILayout.EndHorizontal(); if (GUILayout.Button("Back")) { MGUIEnabled = false; BGUIEnabled = true; } } if (BGUIEnabled) { // if(GUILayout.Button("Connect")) // { // BGUIEnabled = false; // CGUIEnabled = true; //// Application.LoadLevel(""); // } if (GUILayout.Button("Load Game")) { HaveLoaded = true; LoadInformation.Load(); Application.LoadLevel("SchoolLevel"); } if (GUILayout.Button("Options")) { OGUIEnabled = true; BGUIEnabled = false; } } if (OGUIEnabled) { GUILayout.Label("Music"); if (!AGUIEnabled) { if (GUILayout.Button("Off")) { AudioListener.pause = true; AGUIEnabled = true; } } if (AGUIEnabled) { if (GUILayout.Button("On")) { AudioListener.pause = false; AGUIEnabled = false; } } GUILayout.Label("Music Volume"); GUILayout.BeginHorizontal("Box"); if (GUILayout.Button("+")) { AudioListener.volume += 0.1f; } if (GUILayout.Button("-")) { AudioListener.volume -= 0.1f; } GUILayout.EndHorizontal(); if (GUILayout.Button("Back")) { BGUIEnabled = true; OGUIEnabled = false; } } //Associated with the MainMenu if (BGUIEnabled) { if (GUILayout.Button("Wipe Save")) { PlayerPrefs.DeleteAll(); } if (GUILayout.Button("Quit")) { Application.Quit(); } } //Associated with the Connect Button // if (CGUIEnabled) // { // Name = GUILayout.TextField(Name,20); // if (GUILayout.Button ("Warrior")) { // ISWarrior (); // newPlayer.PlayerLevel = 1; // newPlayer.RequiredXp = 100; // newPlayer.PlayerName = Name; // Store (); // Debug.Log ("PlayerClass" + newPlayer.PlayerClass.CharacterClassName); // Application.LoadLevel ("SchoolNetworkingTest"); // // // } // if (GUILayout.Button ("Mage")) { // ISMage (); // newPlayer.PlayerLevel = 1; // newPlayer.RequiredXp = 100; // newPlayer.PlayerName = Name; // Store (); // Debug.Log ("PlayerClass" + newPlayer.PlayerClass.CharacterClassName); // Application.LoadLevel ("SchoolNetworkingTest"); // // } // if (GUILayout.Button ("Ranger")) { // ISRanger (); // newPlayer.PlayerLevel = 1; // newPlayer.RequiredXp = 100; // newPlayer.PlayerName = Name; // Store (); // Debug.Log ("PlayerClass" + newPlayer.PlayerClass.CharacterClassName); // Application.LoadLevel ("SchoolNetworkingTest"); // } // if (GUILayout.Button ("Brawler")) { // ISBrawler (); // newPlayer.RequiredXp = 100; // newPlayer.PlayerLevel = 1; // newPlayer.PlayerName = Name; // Store (); // Debug.Log ("PlayerClass" + newPlayer.PlayerClass.CharacterClassName); // Application.LoadLevel ("SchoolNetworkingTest"); // // } // // if (GUILayout.Button ("Load Game")) // { // HaveLoaded = true; // LoadInformation.Load (); // // Application.LoadLevel ("SchoolLevel"); // } // // if(GUILayout.Button("Back")) // { // CGUIEnabled = false; // BGUIEnabled = true; // } // } GUILayout.EndArea(); }
void DisplayWeaponType(bool isModifiable, ISWeapon tempWeapon) { if(!_weaponTypeOptionsLoaded && isModifiable) { return; } int itemIndex = 0; if(tempWeapon.WeaponType != null) { itemIndex = _weaponTypeDatabase.GetIndex(tempWeapon.WeaponType.Name); } if(itemIndex == -1) { itemIndex = 0; } if(isModifiable) { _weaponTypeSelectedIndex = EditorGUILayout.Popup ("Weapon Type", itemIndex, _weaponTypeOptions); tempWeapon.WeaponType = _weaponTypeDatabase.Get (_weaponTypeSelectedIndex); } else { EditorGUILayout.LabelField("Weapon Type", tempWeapon.WeaponType.Name); } }
void NullTempEntries() { _tempWeapon = null; _tempArmor = null; _tempItem = null; _tempQuality = null; _tempQualityOld = null; _tempWeaponType = null; _tempWeaponTypeOld = null; _tempAttackType = null; _tempAttackTypeOld = null; _tempArmorType = null; _tempArmorTypeOld = null; _tempArmorLocation = null; _tempArmorLocationOld = null; }
void ListWeapons() { for(int i = 0; i < _weaponDatabase.Count; i++) { if(GUILayout.Button(_weaponDatabase.Get(i).Name, GUILayout.Width(_listViewButtonWidth), GUILayout.Height(_listViewButtonHeight))) { _selectedIndex = i; _tempWeapon = new ISWeapon(_weaponDatabase.Get(i)); displayState = DisplayState.DisplayDatabaseEntry; } } }
// Update is called once per frame void Update() { if (Input.GetButtonDown("Pause_Toggle")) { if (!CameraManipulation.x) { CameraManipulation.z = false; CameraManipulation.pause = false; } if (CameraManipulation.x) { CameraManipulation.z = true; } } if (AlphaMenu.HaveLoaded) { for (int cnt = 1; cnt < GameInformation.Inv_A_T; cnt++) { ISArmor isa = ADB.Get(GameInformation.Inventory_A_IDs[cnt]); Armor myArmor = new Armor(); myArmor.Name = isa.Name; myArmor.ItemID = I_A_ID; myArmor.Burden = isa.ISBurden; myArmor.Equipment_Slot = isa.EquipmentSlot; myArmor.Min_Armor_Rate = (int)isa.Armor.x; myArmor.Max_Armor_Rate = (int)isa.Armor.y; myArmor.Durability = isa.Durability; myArmor.Max_Durability = isa.MaxDurability; myArmor.Value = isa.ISValue; GameInformation.InventoryArmors.Add(myArmor); inv_t++; } for (int cnt = 1; cnt < GameInformation.Inv_W_T; cnt++) { ISWeapon isw = WDB.Get(GameInformation.Inventory_W_IDs[cnt]); Weapon myWeapon = new Weapon(); myWeapon.ItemID = I_W_ID; myWeapon.Name = isw.Name; myWeapon.Burden = isw.ISBurden; myWeapon.Equipment_Slot = isw.EquipmentSlot; myWeapon.Min_Damage = isw.MinDamage; myWeapon.Durability = isw.Durability; myWeapon.Max_Durability = isw.MaxDurability; myWeapon.Value = isw.ISValue; myWeapon.Equipment_Element = isw.EQElement; myWeapon.Equipment_Type = isw.EquipmentType; myWeapon.Equipment_Range = isw.EquipmentRange; GameInformation.InventoryWeapons.Add(myWeapon); inv_t++; } for (int cnt = 1; cnt < GameInformation.Inv_P_T; cnt++) { ISPotion isp = PDB.Get(GameInformation.Inventory_P_IDs[cnt]); Potion myPotion = new Potion(); myPotion.Item_ID = I_P_ID; myPotion.Value = isp.ISValue; myPotion.Cool_Down = isp.CoolDownTime; myPotion.Max_Stack = isp.MaxStack; myPotion.Name = isp.Name; GameInformation.InventoryPotions.Add(myPotion); inv_t++; } AlphaMenu.HaveLoaded = false; } }
void OnGUI() { // GUI.skin = PlayerUI; // GUI.Box (new Rect (Screen.width - 100,Screen.height - 50,100,50),"Body Count : " + GameInformation.BodyCount.ToString()); // Variables bool IsDestruction_Magic = false; bool IsDebuff_Magic = false; bool IsSupport_Magic = false; bool IsDefensive_Magic = false; bool IsMelee_Offence = false; bool IsMelee_Defence = false; bool IsSurvival_Instincts = false; bool IsRanged_Offence = false; bool IsRanged_Support = false; bool IsExpertiseMenu = true; // //GuiFunctions inside the Expertise Menu GUILayout.BeginHorizontal("Box"); GUILayout.BeginVertical( ); GUILayout.Label("Max Expertise Points : " + GameInformation.Max_Expertise_Points.ToString()); //Magic GUILayout.BeginHorizontal(); GUILayout.Label("Destructive Magic : " + GameInformation.Magic_Offense.ToString()); if (GUILayout.Button("+")) { if (!IsDestruction_Magic) { IsDestruction_Magic = true; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Debuff Magic : " + GameInformation.Magic_Debuff.ToString()); if (GUILayout.Button("+")) { if (!IsDebuff_Magic) { IsDebuff_Magic = true; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Defensive Magic : " + GameInformation.Magic_Deffence.ToString()); if (GUILayout.Button("+")) { if (!IsDefensive_Magic) { IsDefensive_Magic = true; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Support Magic : " + GameInformation.Magic_Support.ToString()); if (GUILayout.Button("+")) { if (!IsSupport_Magic) { IsSupport_Magic = true; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); //Melee GUILayout.Label("Melee Tacttics : " + GameInformation.Melee_Offence.ToString()); if (GUILayout.Button("+")) { if (!IsMelee_Offence) { IsMelee_Offence = true; } else { IsMelee_Offence = false; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Defensive Techniques : " + GameInformation.Melee_Defence.ToString()); if (GUILayout.Button("+")) { if (!IsMelee_Defence) { IsMelee_Defence = true; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); //Ranged GUILayout.Label("Ranged Techniques : " + GameInformation.Ranged_Offence.ToString()); if (GUILayout.Button("+")) { if (!IsRanged_Offence) { IsRanged_Offence = true; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Ranged Support : " + GameInformation.Ranged_Support.ToString()); if (GUILayout.Button("+")) { if (!IsRanged_Support) { IsRanged_Support = true; } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); if (IsMelee_Offence) { GUILayout.BeginHorizontal( ); GUILayout.Label("1st Strike "); if (GameInformation.Melee_Offence == 200) { GUILayout.Button("/"); } else { GUILayout.Button("X"); } GUILayout.EndHorizontal(); } GUILayout.EndHorizontal(); if (GUI.Button(new Rect(225, 175, Screen.width / 8, 20), "IncreaseLevel")) { AddExperience.AddExp(); } if (GUI.Button(new Rect(225, 205, Screen.width / 8, 20), "Additem A")) { I_A_ID = Random.Range(0, ADB.Count); ISArmor isa = ADB.Get(I_A_ID); GameObject A = new GameObject(); A.name = isa.Name; Armor myArmor = A.AddComponent <Armor>(); myArmor.Name = isa.Name; myArmor.ItemID = I_A_ID; myArmor.Burden = isa.ISBurden; myArmor.Equipment_Slot = isa.EquipmentSlot; myArmor.Min_Armor_Rate = (int)isa.Armor.x; myArmor.Max_Armor_Rate = (int)isa.Armor.y; myArmor.Durability = isa.Durability; myArmor.Max_Durability = isa.MaxDurability; myArmor.Value = isa.ISValue; GameInformation.InventoryArmors.Add(myArmor); inv_t++; } if (GUI.Button(new Rect(225, 225, Screen.width / 8, 20), "Additem W")) { I_W_ID = Random.Range(0, WDB.Count); ISWeapon isw = WDB.Get(I_W_ID); Weapon myweapon = new Weapon(); myweapon.ItemID = I_W_ID; myweapon.Name = isw.Name; myweapon.Burden = isw.ISBurden; myweapon.Equipment_Slot = isw.EquipmentSlot; myweapon.Min_Damage = isw.MinDamage; myweapon.Durability = isw.Durability; myweapon.Max_Durability = isw.MaxDurability; myweapon.Value = isw.ISValue; myweapon.Equipment_Element = isw.EQElement; myweapon.Equipment_Type = isw.EquipmentType; myweapon.Equipment_Range = isw.EquipmentRange; GameInformation.InventoryWeapons.Add(myweapon); inv_t++; } if (GUI.Button(new Rect(225, 245, Screen.width / 8, 20), "Additem P")) { I_P_ID = Random.Range(0, PDB.Count); ISPotion isp = PDB.Get(I_P_ID); Potion myPotion = new Potion(); myPotion.Item_ID = I_P_ID; myPotion.Value = isp.ISValue; myPotion.Cool_Down = isp.CoolDownTime; myPotion.Max_Stack = isp.MaxStack; myPotion.Name = isp.Name; GameInformation.InventoryPotions.Add(myPotion); inv_t++; } GUILayout.BeginHorizontal(); GUILayout.Space(150); GUILayout.Label("Inv"); GUILayout.EndHorizontal(); //PlayerStats GUILayout.BeginVertical("Box"); if (GameInformation.Stat_Points > 0) { GUILayout.Label("Player Name : " + GameInformation.PlayerName); GUILayout.Label("Player Level : " + GameInformation.PlayerLevel.ToString()); GUILayout.Label("Stat Points : " + GameInformation.Stat_Points.ToString()); GUILayout.BeginHorizontal( ); GUILayout.Label("Vitality : " + GameInformation.Vitality); if (GUILayout.Button("-")) { GameInformation.Vitality--; GameInformation.Stat_Points++; if (GameInformation.Vitality < 0) { GameInformation.Stat_Points--; GameInformation.Vitality++; // PlayerUIManager.StatAdjustment (); } } if (GUILayout.Button("+")) { GameInformation.Vitality++; GameInformation.Stat_Points--; // PlayerUIManager.StatAdjustment (); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Endurance : " + GameInformation.Endurance); if (GUILayout.Button("-")) { GameInformation.Endurance--; GameInformation.Stat_Points++; if (GameInformation.Endurance < 0) { GameInformation.Stat_Points--; GameInformation.Endurance++; // PlayerUIManager.StatAdjustment (); } } if (GUILayout.Button("+")) { GameInformation.Endurance++; GameInformation.Stat_Points--; // PlayerUIManager.StatAdjustment (); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Dexetry : " + GameInformation.Dexetry); if (GUILayout.Button("-")) { GameInformation.Dexetry--; GameInformation.Stat_Points++; if (GameInformation.Dexetry < 0) { GameInformation.Stat_Points--; GameInformation.Dexetry++; } } if (GUILayout.Button("+")) { GameInformation.Dexetry++; GameInformation.Stat_Points--; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Intellect : " + GameInformation.Intellect); if (GUILayout.Button("-")) { GameInformation.Intellect--; GameInformation.Stat_Points++; if (GameInformation.Intellect < 0) { GameInformation.Stat_Points--; GameInformation.Intellect++; // PlayerUIManager.StatAdjustment (); } } if (GUILayout.Button("+")) { GameInformation.Intellect++; GameInformation.Stat_Points--; // PlayerUIManager.StatAdjustment (); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Strenght : " + GameInformation.Strength); if (GUILayout.Button("-")) { GameInformation.Strength--; GameInformation.Stat_Points++; if (GameInformation.Strength < 0) { GameInformation.Stat_Points--; GameInformation.Strength++; } } if (GUILayout.Button("+")) { GameInformation.Strength++; GameInformation.Stat_Points--; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Aim : " + GameInformation.Aim); if (GUILayout.Button("-")) { GameInformation.Aim--; GameInformation.Stat_Points++; if (GameInformation.Aim < 0) { GameInformation.Stat_Points--; GameInformation.Aim++; } } if (GUILayout.Button("+")) { GameInformation.Aim++; GameInformation.Stat_Points--; } GUILayout.EndHorizontal(); GUILayout.Label("Money : " + GameInformation.Currency.ToString()); GUILayout.Label("RequiredXp : " + GameInformation.RequiredXP.ToString()); GUILayout.Label("Current Xp : " + GameInformation.CurrentXp.ToString()); GUILayout.EndVertical(); } //Statpoints Controls if stat points reach zero if (GameInformation.Stat_Points == 0) { GUILayout.Label("Player Name : " + GameInformation.PlayerName); GUILayout.Label("Player Level : " + GameInformation.PlayerLevel.ToString()); GUILayout.Label("Stat Points : " + GameInformation.Stat_Points.ToString()); GUILayout.BeginHorizontal( ); GUILayout.Label("Vitality : " + GameInformation.Vitality); if (GUILayout.Button("-")) { GameInformation.Vitality--; GameInformation.Stat_Points++; if (GameInformation.Vitality < 0) { GameInformation.Stat_Points--; GameInformation.Vitality++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Endurance : " + GameInformation.Endurance); if (GUILayout.Button("-")) { GameInformation.Endurance--; GameInformation.Stat_Points++; if (GameInformation.Endurance < 0) { GameInformation.Stat_Points--; GameInformation.Endurance++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Dexetry : " + GameInformation.Dexetry); if (GUILayout.Button("-")) { GameInformation.Dexetry--; GameInformation.Stat_Points++; if (GameInformation.Dexetry < 0) { GameInformation.Stat_Points--; GameInformation.Dexetry++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Intellect : " + GameInformation.Intellect); if (GUILayout.Button("-")) { GameInformation.Intellect--; GameInformation.Stat_Points++; if (GameInformation.Intellect < 0) { GameInformation.Stat_Points--; GameInformation.Intellect++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Strength : " + GameInformation.Strength); if (GUILayout.Button("-")) { GameInformation.Strength--; GameInformation.Stat_Points++; if (GameInformation.Strength < 0) { GameInformation.Stat_Points--; GameInformation.Strength++; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal( ); GUILayout.Label("Aim : " + GameInformation.Aim); if (GUILayout.Button("-")) { GameInformation.Aim--; GameInformation.Stat_Points++; if (GameInformation.Aim < 0) { GameInformation.Stat_Points--; GameInformation.Aim++; } } GUILayout.EndHorizontal(); GUILayout.Label("Money : " + GameInformation.Currency.ToString()); GUILayout.Label("RequiredXp : " + GameInformation.RequiredXP.ToString()); GUILayout.Label("Current Xp : " + GameInformation.CurrentXp.ToString()); GUILayout.EndVertical(); } //PauseMenu Controls if (GUI.Button(new Rect(225, 305, Screen.width / 8, 20), "Resume")) { if (!CameraManipulation.x) { CameraManipulation.z = false; CameraManipulation.pause = false; } if (CameraManipulation.x) { CameraManipulation.z = true; } PlayerUIManager.StatAdjustment(); } if (GUI.Button(new Rect(225, 325, Screen.width / 8, 20), "Exit")) { Time.timeScale = 1; Application.LoadLevel("MainMenu"); DestroyObject(gameObject); } if (GUI.Button(new Rect(225, 350, Screen.width / 8, 20), "Save")) { SaveInformation.Save(); Debug.Log(GameInformation.RequiredXP); } WindowPlaceHolder = GUILayout.Window(WindowID, WindowPlaceHolder, _inventory, "Inventory"); }