Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    static void Init()
    {
        ContractView editor = (ContractView)GetWindow(typeof(ContractView));

        editor.minSize = new Vector2(600, 600);
        ContractModel.LoadContracts();
        editor.Show();
    }
Exemplo n.º 3
0
    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();
    }
Exemplo n.º 4
0
 private void ReloadContracts()
 {
     ContractModel.LoadContracts();
     Repaint();
 }