예제 #1
0
    public JumpgateDataObject GetJumpgateData(int JumpgateID)
    {
        JumpgateDataObject jdo = DataController
                                 .DataAccess
                                 .jumpgateMasterList
                                 .FirstOrDefault(x => x.jumpgateID.Equals(JumpgateID));

        return(jdo);
    }
    //.ElementAt() requires the System.Linq
    public JumpgateDataObject GetJumpgateByID(int ID)
    {
        JumpgateDataObject jdo = new JumpgateDataObject(0, string.Empty, 0, 0, 0, 0);
        if (ID>0)
        {
            jdo = database.Find(x => x.jumpgateID.Equals(ID));
            if (jdo.jumpgateID == null) { jdo = new JumpgateDataObject(0, string.Empty, 0, 0, 0, 0); }
        }

        return jdo;
    }
 private void RecipricateDestinationGate(int EditSectorID, int EditGateID, int DestinationSectorID, int DestinationGateID)
 {
     if (editSectorID != 0 && EditGateID != 0)
     {
         JumpgateDataObject jgdo = (from db in dbJumpgates.database where db.jumpgateID.Equals(DestinationGateID) && db.sectorID.Equals(DestinationSectorID) select db).FirstOrDefault();
         if (jgdo != null)
         {
             jgdo.destinationSectorID   = editSectorID;
             jgdo.destinationJumpgateID = EditGateID;
         }
         //int sector = editSectorID;
         //int gate = EditGateID;
     }
 }
예제 #4
0
    //.ElementAt() requires the System.Linq
    public JumpgateDataObject GetJumpgateByID(int ID)
    {
        JumpgateDataObject jdo = new JumpgateDataObject(0, string.Empty, 0, 0, 0, 0);

        if (ID > 0)
        {
            jdo = database.Find(x => x.jumpgateID.Equals(ID));
            if (jdo.jumpgateID == null)
            {
                jdo = new JumpgateDataObject(0, string.Empty, 0, 0, 0, 0);
            }
        }

        return(jdo);
    }
 public void Remove(JumpgateDataObject dataObject)
 {
     database.Remove(dataObject);
 }
 public void Add(JumpgateDataObject dataObject)
 {
     database.Add(dataObject);
 }
    private void DisplayEdit()
    {
        FilterGatesBySector(editDestinationSectorID);

        EditorGUILayout.BeginHorizontal(GUILayout.Width(Screen.width));

        EditorGUI.BeginDisabledGroup(enableEditArea == false);

        EditorGUILayout.LabelField(editID.ToString(), GUILayout.Width(colID));
        editJumpgateName = EditorGUILayout.TextField(editJumpgateName, GUILayout.Width(colName));
        editSectorID     = EditorGUILayout.IntPopup(editSectorID, sectorNames, sectorIDs, GUILayout.Width(colSectorName));

        //Need to update the destination gates to include just those in the proposed destination sector
        EditorGUI.BeginChangeCheck();
        editDestinationSectorID = EditorGUILayout.IntPopup(editDestinationSectorID, sectorNames, sectorIDs, GUILayout.Width(colDestinationSectorName));
        if (EditorGUI.EndChangeCheck())
        {
            FilterGatesBySector(editDestinationSectorID);
        }

        editDestinationJumpgateID = EditorGUILayout.IntPopup(editDestinationJumpgateID, destGateNames, destGateIDs, GUILayout.Width(colDestinationJumpgateID));    //EditorGUILayout.IntField(editDestinationJumpgateID, GUILayout.Width(250));
        editFee = EditorGUILayout.IntField(editFee, GUILayout.Width(colFee));

        if (GUILayout.Button("Save", GUILayout.Width(colButton1)))
        {
            if (isEdit)
            {
                JumpgateDataObject jdo = dbJumpgates.GetJumpgateByID(editID);
                if (jdo != null)
                {
                    jdo.sectorID              = editSectorID;
                    jdo.jumpgateName          = editJumpgateName;
                    jdo.destinationSectorID   = editDestinationSectorID;
                    jdo.destinationJumpgateID = editDestinationJumpgateID;
                    jdo.fee = editFee;

                    RecipricateDestinationGate(editSectorID, editID, editDestinationSectorID, editDestinationJumpgateID);
                }
                else
                {
                    Debug.LogError("Jumpgate ID " + editID.ToString() + " was not found. Try restarting the panel.");
                }
            }
            else
            {
                JumpgateDataObject jdo = new JumpgateDataObject(editID, editJumpgateName, editSectorID, editDestinationSectorID, editDestinationJumpgateID, editFee);
                dbJumpgates.Add(jdo);
            }

            ClearJumpgate();

            EditorUtility.SetDirty(dbJumpgates);
        }

        if (GUILayout.Button("Cancel", GUILayout.Width(colButton2)))
        {
            ClearJumpgate();
        }

        EditorGUI.EndDisabledGroup();

        EditorGUILayout.EndHorizontal();
    }
    private void DisplayEdit()
    {
        FilterGatesBySector(editDestinationSectorID);

        EditorGUILayout.BeginHorizontal(GUILayout.Width(Screen.width));

        EditorGUI.BeginDisabledGroup(enableEditArea == false);

        EditorGUILayout.LabelField(editID.ToString(), GUILayout.Width(colID));
        editJumpgateName = EditorGUILayout.TextField(editJumpgateName, GUILayout.Width(colName));
        editSectorID = EditorGUILayout.IntPopup(editSectorID, sectorNames, sectorIDs, GUILayout.Width(colSectorName));

        //Need to update the destination gates to include just those in the proposed destination sector
        EditorGUI.BeginChangeCheck();
        editDestinationSectorID = EditorGUILayout.IntPopup(editDestinationSectorID, sectorNames, sectorIDs, GUILayout.Width(colDestinationSectorName));
        if (EditorGUI.EndChangeCheck())
        {
            FilterGatesBySector(editDestinationSectorID);
        }

        editDestinationJumpgateID = EditorGUILayout.IntPopup(editDestinationJumpgateID, destGateNames, destGateIDs, GUILayout.Width(colDestinationJumpgateID));    //EditorGUILayout.IntField(editDestinationJumpgateID, GUILayout.Width(250));
        editFee = EditorGUILayout.IntField(editFee, GUILayout.Width(colFee));

        if (GUILayout.Button("Save", GUILayout.Width(colButton1))) {
            if (isEdit) {
                JumpgateDataObject jdo = dbJumpgates.GetJumpgateByID(editID);
                if (jdo != null) {
                    jdo.sectorID = editSectorID;
                    jdo.jumpgateName = editJumpgateName;
                    jdo.destinationSectorID = editDestinationSectorID;
                    jdo.destinationJumpgateID = editDestinationJumpgateID;
                    jdo.fee = editFee;

                    RecipricateDestinationGate(editSectorID, editID, editDestinationSectorID, editDestinationJumpgateID);
                }
                else
                {
                    Debug.LogError("Jumpgate ID " + editID.ToString() + " was not found. Try restarting the panel.");
                }
            }
            else
            {
                JumpgateDataObject jdo = new JumpgateDataObject(editID, editJumpgateName, editSectorID, editDestinationSectorID, editDestinationJumpgateID, editFee);
                dbJumpgates.Add(jdo);
            }

            ClearJumpgate();

            EditorUtility.SetDirty(dbJumpgates);
        }

        if (GUILayout.Button("Cancel", GUILayout.Width(colButton2))) {
            ClearJumpgate();
        }

        EditorGUI.EndDisabledGroup();

        EditorGUILayout.EndHorizontal();
    }
예제 #9
0
 public void Remove(JumpgateDataObject dataObject)
 {
     database.Remove(dataObject);
 }
예제 #10
0
 public void Add(JumpgateDataObject dataObject)
 {
     database.Add(dataObject);
 }