Ejemplo 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);
    }
Ejemplo n.º 2
0
        public ContractData(bool isPassenger, IGameLogicInteractable game, Contract contract, Flight flight)
        {
            InitializeComponent();

            this.game     = game;
            this.flight   = flight;
            this.contract = contract;

            BackColor           = MainForm.MostlyBackColor;
            btnDo.BackColor     = MainForm.MostlyBackColor;
            btnDelete.BackColor = MainForm.MostlyBackColor;
            btnDelete.FlatStyle = FlatStyle.Flat;
            if (isPassenger)
            {
                lblType.Text          = "Пассажиры:";
                lblType.Width         = 109;
                lblTypeValue.Location = new Point(124, 80);
                lblTime.Visible       = false;
                lblTimeValue.Visible  = false;
            }
            else
            {
                lblType.Text          = "Грузоподъемность:";
                lblType.Width         = 175;
                lblTypeValue.Location = new Point(190, 80);
                lblTime.Visible       = false;
                lblTimeValue.Visible  = false;
            }

            newForm = new ContractForm(this.game, this.contract, flight.Number);
        }
Ejemplo n.º 3
0
    public static ContractForm Init()
    {
        ContractForm editor = (ContractForm)GetWindow(typeof(ContractForm));

        editor.minSize          = new Vector2(400, 600);
        editor.replacementIndex = -1;
        editor.InternalInit();
        editor.Show();

        return(editor);
    }
Ejemplo n.º 4
0
        /// <summary>
        /// Inserts a review type
        /// </summary>
        /// <param name="item">Review type</param>
        public virtual void InsertContractForm(ContractForm item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            _itemRepository.Insert(item);
            _cacheManager.RemoveByPattern(GSCatalogDefaults.ContractFormByPatternKey);

            //event notification
            _eventPublisher.EntityInserted(item);
        }
Ejemplo n.º 5
0
        private void NewContract_Click(object sender, System.EventArgs e)
        {
            using (var form = new ContractForm())
            {
                form.SetDataBindings();
                var result = form.ShowDialog();

                if (result == DialogResult.OK)
                {
                    _contractsClient.Create(form.Contract);

                    RefreshAllData();
                }
            }
        }
Ejemplo n.º 6
0
        public static void AddSafely(this EditorContract contract, ContractForm form, ContractFormField field)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }

            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            //form.Fields.Add(field);
            form.WithMigrator(contract.GetMigrator()).AddField(field);
        }
Ejemplo n.º 7
0
    public static ContractForm Init(ContractModel existingContract, int replacementIndex)
    {
        ContractForm editor = (ContractForm)GetWindow(typeof(ContractForm));

        editor.minSize = new Vector2(400, 600);
        editor.InternalInit();
        editor.Show();

        editor.Tier                = existingContract.Tier;
        editor.Title               = existingContract.Title;
        editor.TargetName          = existingContract.TargetName;
        editor.Description         = existingContract.Description;
        editor.TargetImagePath     = existingContract.TargetImagePath;
        editor.TargetShipImagePath = existingContract.TargetShipImagePath;
        editor.Objectives          = existingContract.Objectives.ToList();

        editor.replacementIndex = -1;
        editor.closeButtonText  = "Save";

        return(editor);
    }
Ejemplo n.º 8
0
        public static void RemoveSafely(this EditorContract contract, ContractForm form, ContractFormField field)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }

            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            //Remove all risks
            contract.AnalyzeIntegrityOf(form, field).ResolveDeleteRisks();

            //Remove this
            //form.Fields.Remove(field);
            form.WithMigrator(contract.GetMigrator()).RemoveField(field);
        }
Ejemplo n.º 9
0
        public static ContractIntegrityAnalysisResult AnalyzeIntegrityOf(this EditorContract contract, ContractForm form, ContractFormField field)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }

            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            return(ContractIntegrityAnalysisResult.Empty());
        }
Ejemplo n.º 10
0
    private void DisplayContract(ContractModel contract)
    {
        GUILayout.BeginVertical(EditorStyles.helpBox);
        {
            //Controls to move contract up and down
            EditorGUILayout.BeginHorizontal();
            {
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Label("Tier: " + contract.Tier);
            GUILayout.Label("Title: " + contract.Title);
            GUILayout.Label("Target Name: " + contract.TargetName);
            GUILayout.Label("Description: \n" + contract.Description);

            //Try to get prefetched images
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.BeginVertical();
                {
                    string targetImagePath = contract.TargetImagePath;

                    if (ContractModel.ContractTargetImages.ContainsKey(targetImagePath))
                    {
                        GUILayout.Label("Target Image - " + targetImagePath);
                        GUILayout.Label(ContractModel.ContractTargetImages[targetImagePath]);
                    }
                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical();
                {
                    string targetShipImagePath = contract.TargetShipImagePath;

                    if (ContractModel.ContractTargetShipImages.ContainsKey(targetShipImagePath))
                    {
                        GUILayout.Label("Target Ship Image - " + targetShipImagePath);
                        GUILayout.Label(ContractModel.ContractTargetShipImages[targetShipImagePath]);
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();

            //Display objectives
            if (contract.Objectives.Length > 0)
            {
                EditorGUILayout.Space();
                GUILayout.Label("Objectives:");

                foreach (Objective objective in contract.Objectives)
                {
                    GUILayout.Label(objective.GetType().ToString() + " - " + objective.sector.name);
                }
            }
            else
            {
                GUILayout.Label("No Objectives :(");
            }


            EditorGUILayout.BeginHorizontal();
            {
                //Buttons to move contract up and down
                if (GUILayout.Button("▲"))
                {
                    MoveUp(contract);
                }
                GUILayout.Space(6);

                if (GUILayout.Button("▼"))
                {
                    MoveDown(contract);
                }
                GUILayout.Space(6);

                GUILayout.FlexibleSpace();

                //Edit and delete buttons in their own horizontal across the bottom
                if (GUILayout.Button("Edit"))
                {
                    int          index             = ContractModel.Contracts.IndexOf(contract);
                    ContractForm newContractEditor = ContractForm.Init(contract, index);
                    newContractEditor.OnClose = ReloadContracts;
                }
                if (GUILayout.Button("Delete"))
                {
                    if (EditorUtility.DisplayDialog("Deleting Contract", "You can't get this contract back if you delete it. Are you sure you want to delete it?", "Yes I hate this contract"))
                    {
                        ContractModel.Contracts.Remove(contract);
                        ContractModel.WriteContracts();
                    }
                }
                GUILayout.Space(6);
            }
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(6);
        }
        GUILayout.EndVertical();

        GUILayout.Space(12);
    }
Ejemplo n.º 11
0
 public Contract(int employeeid, DateTimeOffset startdate, DateTimeOffset?enddate, ContractForm contracttype, decimal remuneration)
 {
     EmployeeId     = employeeid;
     StartDate      = startdate;
     EndDate        = enddate;
     ContractTypeId = (int)contracttype;
     Remuneration   = remuneration;
     CreatedOn      = DateTimeOffset.Now;
 }