Last active
March 10, 2019 17:51
-
-
Save ZeredaGames/b3059d3ad25cce06603c08567e9ee5e7 to your computer and use it in GitHub Desktop.
All that I've got so far.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum PartTypes | |
{ | |
Disabled, | |
ShipArmor, | |
BeamGenerator, | |
BeamCharger, | |
EnergyShield, | |
ShieldGenerator, | |
MissileMagazine, | |
Specials, | |
} | |
public enum Grade | |
{ | |
Grade1, | |
Grade2, | |
Grade3, | |
Grade4, | |
Grade5, | |
Grade6, | |
Grade7, | |
} | |
// - \/ Goes in a class not using atm... | |
// private List<string> PartTypesStringsList = new List<string>() { | |
// PartTypes.Disabled.ToString(), | |
// PartTypes.ShipArmor.ToString(), | |
// PartTypes.BeamGenerator.ToString(), | |
// PartTypes.BeamCharger.ToString(), | |
// PartTypes.EnergyShield.ToString(), | |
// PartTypes.ShieldGenerator.ToString(), | |
// PartTypes.MissileMagazine.ToString(), | |
// PartTypes.Specials.ToString(), | |
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.UI; | |
using UnityEditor; | |
public class Slot : MonoBehaviour { | |
public static Slots parent; | |
public static int PlayerLevel; | |
public static Slot slot; | |
public int SlotIndex; | |
public bool IsSlotUnlocked; | |
private Grade CurrentPartGrade; | |
private PartTypes CurrentPartType; | |
public int CurrentObjectSelection; | |
private string CurrentPartName; | |
private int CurrentPartLevel; | |
private GameObject CurrentHoldObject; | |
public SlotPartRequirment SlotsRequirements; | |
public List<GameObject> availableObjects = new List<GameObject>(); | |
void Awake() { | |
parent = GetComponentInParent<Slots>(); | |
slot = parent.AllSlots[SlotIndex]; | |
// PlayerLevel = Player.PlayerLevel; | |
IsSlotUnlocked = parent.UnlockedPartSlots[SlotIndex]; | |
CurrentPartGrade = parent.SlotGrade[SlotIndex]; | |
CurrentPartType = parent.SlotPartType[SlotIndex]; | |
CurrentHoldObject = availableObjects[CurrentObjectSelection]; | |
CurrentPartName = availableObjects[CurrentObjectSelection].GetComponent<Blueprint>().BluePrintName; | |
if (CurrentPartLevel <= PlayerLevel) { | |
CurrentPartLevel = SlotsRequirements.levelsRequired[parent.Selection][CurrentObjectSelection]; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
public class SlotEditor : EditorWindow { | |
//Editor Variables | |
//private static int CurrentSlotCount = 7; | |
//private static int MaxSlotCount = 7; | |
//private const int MinSlotCount = 1; | |
private BlueprintDatabase blueprintDatabase = null; | |
private ItemDataBaseList itemDatabase = null; | |
private Vector2 scrollPosition; | |
public static SlotEditor editor; | |
//Edit To Send back | |
private Slot SlotToEdit; | |
private static SlotPartRequirmentEditor requirementsEditor; | |
private List<PartTypes> SlotPartType = new List<PartTypes>(7) { PartTypes.Disabled }; | |
private List<Slot> AllSlots = new List<Slot>(); | |
private List<List<GameObject>> availableObjectsLists = new List<List<GameObject>>(); | |
//Use to edit | |
private int CurrentSlotSelection = 7; | |
private int selection = 1; | |
private List<string> NamesList = new List<string>(); | |
private PartTypes changeType; | |
private Slots slotsObject; | |
void OnChangeData(Slot slot) { | |
SlotPartType[CurrentSlotSelection] = changeType; | |
slotsObject.SlotPartType = SlotPartType; | |
slotsObject.AllSlots = AllSlots; | |
slot.SlotIndex = selection; | |
slot.SlotsRequirements = requirementsEditor.req; | |
slot.availableObjects = availableObjectsLists[selection]; | |
} | |
public void Init(int selection, Slots slotsObject, List<Slot> slots, Slot slot, List<PartTypes> partTypesList, List<List<GameObject>> availableObjectsLists) | |
{ | |
editor = (SlotEditor)GetWindow(typeof(EditorWindow)); | |
CurrentSlotSelection = selection; | |
SlotToEdit = slot; | |
AllSlots = slots; | |
SlotPartType = partTypesList; | |
this.slotsObject = slotsObject; | |
this.availableObjectsLists = availableObjectsLists; | |
} | |
void OnGUI() | |
{ | |
if (itemDatabase == null) | |
itemDatabase = (ItemDataBaseList)Resources.Load("ItemDatabase"); | |
if (blueprintDatabase == null) | |
blueprintDatabase = (BlueprintDatabase)Resources.Load("BlueprintDatabase"); | |
GUILayout.BeginHorizontal(); | |
selection = GUILayout.Toolbar(selection, NamesList.ToArray(), EditorStyles.toolbarDropDown); | |
GUILayout.EndHorizontal(); | |
scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); | |
GUILayout.Space(10); | |
selection = EditorGUILayout.Popup("Type Item Slot:", selection, NamesList.ToArray(), EditorStyles.popup); | |
if (GUILayout.Button("Edit Requirments")) { | |
OnEditSlotPartRequirment(); | |
} | |
OnChangeData(SlotToEdit); | |
} | |
void GetSelection() | |
{ | |
//CurrentSlotCount = EditorGUILayout.IntSlider("Slot:", CurrentSlotCount, MinSlotCount, MaxSlotCount, GUILayout.Width(position.width - 38)); | |
//MaxSlotCount = slots.Count; | |
//slots[CurrentSlotSelection].CurrentSetItemType = NamesList[selection]; | |
//GUILayout.Label(slots[selection].CurrentSetItemType); | |
} | |
public void OnEditSlotPartRequirment() | |
{ | |
requirementsEditor = (SlotPartRequirmentEditor)GetWindow(typeof(EditorWindow)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SlotPartRequirment : MonoBehaviour | |
{ | |
public PartTypes SlotPartsType; | |
public Grade CurrentAloudGrade = Grade.Grade1; | |
public float Integrity = 0; | |
public string GoalRequired; | |
public bool RequireLevel; | |
public bool RequireIntegrity; | |
public bool RequireGoalComplete; | |
public readonly List<List<int>> levelsRequired = new List<List<int>>() { ShipArmorUpgradeLevels, BeamGeneratorUpgradeLevels, BeamChargerUpgradeLevels, EnergyShieldUpgradeLevels, ShieldGeneratorUpgradeLevels, MissileMagazineUpgradeLevels, SpecialsUpgradeLevels }; | |
public static List<int> ShipArmorUpgradeLevels = new List<int>() { 14, 18, 23, 32, 38, 43, 50 }; | |
public static List<int> BeamGeneratorUpgradeLevels = new List<int>() { 14, 19, 24, 33, 39, 44, 52 }; | |
public static List<int> BeamChargerUpgradeLevels = new List<int>() { 15, 20, 26, 34, 40, 46, 54 }; | |
public static List<int> EnergyShieldUpgradeLevels = new List<int>() { 16, 21, 29, 36, 41, 47, 55 }; | |
public static List<int> ShieldGeneratorUpgradeLevels = new List<int>() { 16, 21, 29, 36, 41, 47, 55 }; | |
public static List<int> MissileMagazineUpgradeLevels = new List<int>() { 17, 22, 31, 37, 42, 49, 57 }; | |
public static List<int> SpecialsUpgradeLevels = new List<int>() { 0, 0, 22, 31, 37, 42, 49, 57 }; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
public class SlotPartRequirmentEditor : EditorWindow | |
{ | |
public SlotPartRequirment req; | |
//public Slot obj; | |
//void OnChangeColor() { | |
// if (obj.currentSlotsRequirements.Integrity == 0) | |
// GUI.backgroundColor = Color.green; | |
// else if (obj.currentSlotsRequirements.Integrity < 0) | |
// GUI.backgroundColor = Color.blue; | |
// else if (obj.currentSlotsRequirements.Integrity > 0) | |
// GUI.backgroundColor = Color.red; | |
//} | |
//void OnGUI() | |
//{ | |
// if (obj == null) | |
// return; | |
// //draw label for selected IAP name | |
// EditorGUILayout.BeginHorizontal(); | |
// EditorGUILayout.LabelField("IAP:", GUILayout.Width(40)); | |
// EditorGUILayout.LabelField(obj.CurrentSelection.ToString(), EditorStyles.boldLabel); | |
// EditorGUILayout.EndHorizontal(); | |
// EditorGUILayout.Space(); | |
// EditorGUILayout.LabelField("Locked Settings", EditorStyles.boldLabel); | |
// obj.currentSlotsRequirements.RequireGoalComplete = EditorGUILayout.Toggle(new GUIContent("RequireGoalComplete [?]", ""), obj.currentSlotsRequirements.RequireGoalComplete); | |
// if (obj.currentSlotsRequirements.RequireGoalComplete) | |
// { | |
// if (!string.IsNullOrEmpty(obj.currentSlotsRequirements.GoalRequired)) | |
// { | |
// if (obj.currentSlotsRequirements.Integrity == 0) | |
// GUI.backgroundColor = Color.green; | |
// else if (obj.currentSlotsRequirements.Integrity < 0) | |
// GUI.backgroundColor = Color.blue; | |
// else if (obj.currentSlotsRequirements.Integrity > 0) | |
// GUI.backgroundColor = Color.red; | |
// obj.currentSlotsRequirements.GoalRequired = EditorGUILayout.TextField(new GUIContent("Goal Required [?]", "" + | |
// ""), obj.currentSlotsRequirements.GoalRequired); | |
// } | |
// } | |
// obj.currentSlotsRequirements.RequireIntegrity = EditorGUILayout.Toggle(new GUIContent("RequireIntegrity [?]", ""), obj.currentSlotsRequirements.RequireIntegrity); | |
// if (obj.currentSlotsRequirements.RequireIntegrity) | |
// { | |
// for (int i = 0; i < obj.currentSlotsRequirements.levelsRequired.Count; i++) | |
// { | |
// for (int B = 0; B < obj.currentSlotsRequirements.levelsRequired[i].Count; B++) | |
// { | |
// obj.currentSlotsRequirements.levelsRequired[i][B] = EditorGUILayout.IntField(new GUIContent("Levels Required [?]", "" + | |
// ""), obj.currentSlotsRequirements.levelsRequired[i][B]); | |
// } | |
// } | |
// obj.currentSlotsRequirements.Integrity = EditorGUILayout.FloatField(new GUIContent("Integrity [?]", ""), obj.currentSlotsRequirements.Integrity); | |
// if (obj.currentSlotsRequirements.Integrity == 0) | |
// GUI.backgroundColor = Color.green; | |
// else if (obj.currentSlotsRequirements.Integrity < 0) | |
// GUI.backgroundColor = Color.blue; | |
// else if (obj.currentSlotsRequirements.Integrity > 0) | |
// GUI.backgroundColor = Color.red; | |
// } | |
// obj.currentSlotsRequirements.RequireLevel = EditorGUILayout.Toggle(new GUIContent("RequireLevel [?]", ""), obj.currentSlotsRequirements.RequireLevel); | |
// if (obj.currentSlotsRequirements.RequireLevel) | |
// { | |
// } | |
// obj.currentSlotsRequirements.AloudParts = (PartTypes)EditorGUILayout.EnumPopup(new GUIContent("AloudParts [?]", ""), (PartTypes)obj.currentSlotsRequirements.AloudParts); | |
// EditorGUILayout.Space(); | |
// EditorGUILayout.LabelField("Upgrades", EditorStyles.boldLabel); | |
// if (!string.IsNullOrEmpty(obj.currentSlotsRequirements.nextId)) | |
// GUI.backgroundColor = Color.yellow; | |
// obj.currentSlotsRequirements.nextId = EditorGUILayout.TextField(new GUIContent("Next product [?]", "Product Id of the upgrade that comes after this one"), obj.currentSlotsRequirements.nextId); | |
// GUI.backgroundColor = Color.white; | |
//} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Slots : MonoBehaviour | |
{ | |
public int Selection; | |
public string Tag = "Slots"; | |
public List<Slot> AllSlots = new List<Slot>(); | |
public List<PartTypes> SlotPartType = new List<PartTypes>(7) { PartTypes.Disabled }; | |
public List<Grade> SlotGrade = new List<Grade>(7) { Grade.Grade1 }; | |
public List<bool> UnlockedPartSlots = new List<bool>(7) {false}; | |
public List<List<GameObject>> availableObjectsLists = new List<List<GameObject>>(); | |
void Awake() { | |
gameObject.tag = Tag; | |
} | |
public void OnEditSlot() | |
{ | |
#if UNITY_EDITOR | |
SlotEditor.editor.Init(Selection, this, AllSlots,AllSlots[Selection], SlotPartType, availableObjectsLists); | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment