コード例 #1
0
        private void buttonDockToObject_Click(object sender, EventArgs e)
        {
            if (_map_scene == null)
            {
                Console.WriteLine("In buttonDockToObject_Click: Current Scene is null");
                return;
            }
            DDDObjects obj = _map_scene.GetSelectedObject();
            if (obj == null)
            {
                Console.WriteLine("In buttonDockToObject_Click: Selected object is null");
                return;
            }

            string selectedParent;
            string selectedObjectID = obj.ObjectID;
            string requestorID = DDD_Global.Instance.PlayerID;
            List<string> listOfVisibleObjects = new List<string>();
            listOfVisibleObjects.AddRange(_map_scene.GetListOfPlayfieldObjects());
            listOfVisibleObjects.Remove(selectedObjectID);

            DropdownDialog dlg = new DropdownDialog("Asset Docking Dialog", String.Format("Select the Asset to dock this asset ({0}) to:", selectedObjectID), listOfVisibleObjects);
            selectedParent = dlg.ShowDialog(this);

            if (selectedParent == string.Empty)
            {
                return;
            }

            _map_scene.DockObjectRequest(requestorID, selectedObjectID, selectedParent, true);
        }
コード例 #2
0
        private void buttonTransferAsset_Click(object sender, EventArgs e)
        {
            if (_map_scene == null)
            {
                Console.WriteLine("In buttonTransferAsset_Click: Current Scene is null");
                return;
            }
            DDDObjects obj = _map_scene.GetSelectedObject();
            if (obj == null)
            {
                Console.WriteLine("In buttonTransferAsset_Click: Selected object is null");
                return;
            }

            string selectedDM;
            string selectedObjectID = obj.ObjectID;
            string objectState = obj.State;
            List<string> availableDMs = DDD_Global.Instance.DM_List;
            availableDMs.Remove(DDD_Global.Instance.PlayerID);

            DropdownDialog dlg = new DropdownDialog("Unit Transfer Dialog", String.Format("Select the Decision Maker to transfer this unit ({0}) to:", selectedObjectID), availableDMs);
            selectedDM = dlg.ShowDialog(this);

            if (selectedDM == string.Empty)
            {
                return;
            }

            _map_scene.TransferObjectRequest(DDD_Global.Instance.PlayerID, selectedObjectID, selectedDM, objectState);

        }