void OnGUI() { SetEditorStyles(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); for (int i = 0; i < ContractModel.Contracts.Count; i++) { DisplayContract(ContractModel.Contracts[i]); } EditorGUILayout.EndScrollView(); GUILayout.Space(12); GUILayout.FlexibleSpace(); GUILayout.Space(6); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Refresh Contracts")) { ContractModel.LoadContracts(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("New Contract")) { ContractForm newContractEditor = ContractForm.Init(); newContractEditor.OnClose = ReloadContracts; } GUILayout.Space(6); EditorGUILayout.EndHorizontal(); GUILayout.Space(6); }
static void Init() { ContractView editor = (ContractView)GetWindow(typeof(ContractView)); editor.minSize = new Vector2(600, 600); ContractModel.LoadContracts(); editor.Show(); }
private void AddData() { //Reload contracts ContractModel.LoadContracts(); ContractModel model = new ContractModel(Tier, Title, TargetName, Description, TargetImagePath, TargetShipImagePath, Objectives.ToArray()); if (replacementIndex >= 0) { ContractModel.Contracts.RemoveAt(replacementIndex); ContractModel.Contracts.Insert(replacementIndex, model); } else { ContractModel.Contracts.Add(model); } ContractModel.WriteContracts(); Close(); }
private void ReloadContracts() { ContractModel.LoadContracts(); Repaint(); }