示例#1
0
        private void DoDeploy()
        {
            IDeployable deploy = tvProjects.SelectedNode.Tag as IDeployable;

            if (deploy == null)
            {
                return;
            }

            deploy.Deploy();
        }
示例#2
0
        public bool TryDeploy(int index = 0)
        {
            if (_inventory.Count <= index)
            {
                Debug.Log($"ENTITY: ERROR, OUT OF RANGE INVENTORY INDEX: {index} {_inventory.Count}");
                return(false);
            }
            IDeployable item = _inventory[index] as IDeployable;

            if (item == null)
            {
                Debug.Log("ENTITY: ERROR, NON-ITEM IN INVENTORY");
                return(false);
            }

            if (item.Deploy(CurrentPosition, (byte)_context.factionID))
            {
                _inventory.RemoveAt(index);
                return(true);
            }

            return(false);
        }
示例#3
0
        protected override void unbuilt_kits_pane()
        {
            if (unbuilt_kits.Count == 0)
            {
                return;
            }
            GUILayout.Label("Available DIY kits:", Styles.label, GUILayout.ExpandWidth(true));
            GUILayout.BeginVertical(Styles.white);
            BeginScroll(unbuilt_kits.Count, ref unbuilt_scroll);
            ConstructionKitInfo add    = null;
            IDeployable         deploy = null;

            foreach (var info in unbuilt_kits)
            {
                GUILayout.BeginHorizontal();
                draw_task(info);
                if (info.ConstructionSpace is IDeployable depl)
                {
                    if (depl.State == DeploymentState.DEPLOYED)
                    {
                        if (GUILayout.Button(
                                new GUIContent("Add", "Add this kit to construction queue"),
                                Styles.enabled_button,
                                GUILayout.ExpandWidth(false),
                                GUILayout.ExpandHeight(true)))
                        {
                            add = info;
                        }
                    }
                    else if (depl.State != DeploymentState.DEPLOYING)
                    {
                        if (GUILayout.Button(
                                new GUIContent("Deploy", "Deploy this kit and fix it to the ground"),
                                Styles.active_button,
                                GUILayout.ExpandWidth(false),
                                GUILayout.ExpandHeight(true)))
                        {
                            deploy = depl;
                        }
                    }
                    else
                    {
                        GUILayout.Label(DeployableStatus(depl),
                                        Styles.boxed_label,
                                        GUILayout.ExpandWidth(true),
                                        GUILayout.ExpandHeight(true));
                    }
                }
                else if (GUILayout.Button(
                             new GUIContent("Add", "Add this kit to construction queue"),
                             Styles.enabled_button,
                             GUILayout.ExpandWidth(false),
                             GUILayout.ExpandHeight(true)))
                {
                    add = info;
                }
                GUILayout.EndHorizontal();
            }
            if (add != null)
            {
                Queue.Enqueue(add);
            }
            else if (deploy != null)
            {
                deploy.Deploy();
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();
        }
示例#4
0
 public void Deploy()
 {
     iDeployable.Deploy();
 }