Exemplo n.º 1
0
    public void updateUI()
    {
        if(buildingTarget == null)
            buildingTarget = HQ.getInstance ();

        textLVL.text = buildingTarget.level.ToString ();
        textPV.text = buildingTarget.PV.ToString ();

        if( buildingTarget.upgradeLink != null && buildingTarget.upgradeLink.upgradeLevel.Count > 0){
            buttonUpgrade.SetActive(true);

            string upgradeText = "Upgrade\n" + "Cout :";

            foreach(RessourceInQuantity riq in buildingTarget.upgradeLink.upgradeLevel[0].cost ){
                upgradeText += " "+riq.quantity+" "+riq.ressourceName;
            }

            textUpgrade.text = upgradeText;
        }
        else{
            buttonUpgrade.SetActive(false);
        }

        woodQuantityText.text = Warehouse.getInstance ().getRessourceQuantityInBase (GameRessources.Wood).ToString ();
        metalQuantityText.text = Warehouse.getInstance ().getRessourceQuantityInBase (GameRessources.Metal).ToString ();
    }
Exemplo n.º 2
0
        protected Base()
        {
            ObjConstants = new Constants();
            ObjHeroes    = new Heroes();
            ObjMinions   = new Minions();
            ObjTurrets   = new Turrets();
            Menu         = new Menu("AIM", "AIM", true);


            //AIM Settings
            Menu.AddItem(new MenuItem("Enabled", "Enabled").SetValue(new KeyBind(32, KeyBindType.Toggle)));
            Menu.AddItem(new MenuItem("LowHealth", "Self Low Health %").SetValue(new Slider(20, 10, 50)));

            //Humanizer
            var move = Menu.AddSubMenu(new Menu("Humanizer", "humanizer"));

            move.AddItem(new MenuItem("MovementEnabled", "Enabled").SetValue(true));
            move.AddItem(new MenuItem("MovementDelay", "Movement Delay")).SetValue(new Slider(400, 0, 1000));

            Menu.AddToMainMenu();

            Console.WriteLine("Menu Init Success!");

            ObjHQ     = new HQ();
            Orbwalker = Menu.AddSubMenu(new Menu("Orbwalker", "Orbwalker"));
            OrbW      = new Orbwalking.Orbwalker(Orbwalker);

            Obj_AI_Base.OnIssueOrder += Obj_AI_Base_OnIssueOrder;
        }
Exemplo n.º 3
0
        protected override void Initialize()
        {
            Textures.LoadTextures(this.Content);

            #region Camera
            Camera           = new Camera(Graphics.GraphicsDevice);
            CameraPosition.X = Graphics.PreferredBackBufferWidth * 1.0f / 2;
            CameraPosition.Y = Graphics.PreferredBackBufferHeight * 1.0f / 2;
            #endregion

            #region Screen Setup
            //ResolutionHandler.resolution = ResolutionHandler.Resolution.Three;

            //ToDo 3 Fix to draw background texture to fill all of the background
            MapSizeX = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            MapSizeY = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;

            SpriteBatch = new SpriteBatch(GraphicsDevice);

            Window.Title = "Zeds - Alpha " + versionNumber;
            #endregion

            #region Mouse
            IsMouseVisible     = false;
            MouseCoordinates.X = Graphics.PreferredBackBufferWidth * 1.0f / 2;
            MouseCoordinates.Y = Graphics.PreferredBackBufferWidth * 1.0f / 2;
            KeyBindings.PreviousScrollValue = 0;
            #endregion

            //Initial set up
            HQ.HQSetup();
            HumanNames.PopulateNamesLists();

            HumanSpawner.SpawnHumans();
            GrantStartingItems.PopulateItemList();

            #region Terrain
            GrassTufts.CreateGrassTufts();
            Bushes.CreateBushes();
            Trees.CreateTrees();
            Trees.CreateTreeFoliage();
            #endregion

            #region Build Menu
            BuildingPlacementHandler.SelectedStructure = BuildingSelected.None;

            PopulateBuildMenus.PopulateMenuIconList();
            BuildMenuPane.InitialiseBuildMenuLocation();
            BuildMenuPane.IsBuildMenuWindowVisible = true;
            BuildMenuRollOverText.UpdateRollOverTextPosition();
            #endregion

            DetailsPane.CreateDetailsPane(new Vector2((ScreenWidth / 2) - (Textures.DetailsWindowPane.Width / 2), 10), "");

            base.Initialize();

            ZedController.PopulateZedList();

            Grid.SetUpGrid();
        }
Exemplo n.º 4
0
        private static void     OnGUISettings()
        {
            if (Utility.IsCustomEditorCompatible == false)
            {
                EditorGUILayout.HelpBox("NG Tools has detected a change in Unity code. Please contact the author.", MessageType.Error);

                if (GUILayout.Button("Contact the author") == true)
                {
                    ContactFormWizard.Open(ContactFormWizard.Subject.BugReport, "MonoScriptEditor is incompatible with " + Utility.UnityVersion + ".");
                }
                return;
            }

            InspectorGadgetSettings settings = HQ.Settings.Get <InspectorGadgetSettings>();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Script visualizer lets you select the text when you inspect a script.", GeneralStyles.WrapLabel);
            bool active = NGEditorGUILayout.Switch("Script Visualizer", settings.activeScriptVisualizer);

            if (EditorGUI.EndChangeCheck() == true)
            {
                bool mustUpdate = active == true?Utility.AddCustomEditor(typeof(MonoScript), typeof(MonoScriptEditor)) : Utility.RemoveCustomEditor(typeof(MonoScriptEditor));

                if (mustUpdate == true)
                {
                    MonoScriptEditor.UpdateInspector();
                }

                settings.activeScriptVisualizer = active;
                HQ.InvalidateSettings();
            }
        }
Exemplo n.º 5
0
        private static void     OnGUIPresets()
        {
            if (ConsoleSettingsEditor.presetTypes == null)
            {
                List <Type>   types = new List <Type>(4);
                List <string> names = new List <string>(4);

                foreach (Type c in Utility.EachNGTSubClassesOf(typeof(Preset)))
                {
                    types.Add(c);
                    names.Add(Utility.NicifyVariableName(c.Name));
                }

                ConsoleSettingsEditor.presetTypes = types.ToArray();
                ConsoleSettingsEditor.presetNames = names.ToArray();
            }

            for (int i = 0; i < ConsoleSettingsEditor.presetTypes.Length; i++)
            {
                if (GUILayout.Button(ConsoleSettingsEditor.presetNames[i]) == true &&
                    ((Event.current.modifiers & Constants.ByPassPromptModifier) != 0 || EditorUtility.DisplayDialog(ConsoleSettingsEditor.presetNames[i], LC.G("NGSettings_ConfirmApply"), LC.G("Yes"), LC.G("No")) == true))
                {
                    Preset preset = Activator.CreateInstance(ConsoleSettingsEditor.presetTypes[i]) as Preset;

                    preset.SetSettings(HQ.Settings);

                    EditorUtility.UnloadUnusedAssetsImmediate();
                    HQ.InvalidateSettings();
                    InternalNGDebug.Log("Preset \"" + ConsoleSettingsEditor.presetNames[i] + "\" applied on " + HQ.Settings + ".");
                }
            }
        }
Exemplo n.º 6
0
        private static void     OnGUISettings()
        {
            if (HQ.Settings == null)
            {
                return;
            }

            EditorGUILayout.Space();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.LabelField("Add an offset on NG Hub's window Y-axis.", GeneralStyles.WrapLabel);
            float offset = EditorGUILayout.FloatField("Y Offset Window", HQ.Settings.Get <HubSettings>().NGHubYOffset);

            EditorGUILayout.HelpBox("This is a workaround. Most of the time NG Hub is correctly placed, but in some cases, it is not.", MessageType.Info);
            EditorGUILayout.HelpBox("If you have the offset bug and you are willing to fix it, contact me through " + Constants.SupportEmail + ".", MessageType.Info);

            if (GUILayout.Button("Contact the author") == true)
            {
                ContactFormWizard.Open(ContactFormWizard.Subject.Support);
            }

            if (EditorGUI.EndChangeCheck() == true)
            {
                HQ.Settings.Get <HubSettings>().NGHubYOffset = offset;
                HQ.InvalidateSettings();
            }
        }
Exemplo n.º 7
0
    // Start is called before the first frame update
    void Start()
    {
        _worldController = WorldController.GetWorldController;
        if (_cameraStartLocation != null)
        {
            _worldController.GetComponent <CameraScript>().SetCameraPosAndRot(_cameraStartLocation.position, _cameraStartLocation.rotation.eulerAngles.y);
            _worldController.GetComponent <CameraScript>().SetZoom(0.5f);
        }
        else
        {
            HQ HQPos = WorldController.GetWorldController._HQ;
            if (HQPos != null)
            {
                _worldController.GetComponent <CameraScript>().SetCameraPosAndRot(HQPos.transform.position, 0.0f);
            }
            _worldController.GetComponent <CameraScript>().SetZoom(0.5f);
        }
        LevelInfo levelInfo = LevelInfo._levelInfo;

        _objectiveMenu = levelInfo._objectiveMenu;
        //_victoryPanal = levelInfo._victoryPanal;
        //_defeatPanal = levelInfo._defeatPanal;
        //_statsDisplay = levelInfo._statsDisplay;
        //_defeatText = levelInfo._defeatText;
        AfterStart();
    }
Exemplo n.º 8
0
 public Players()
 {
     Base     = new HQ();
     Money    = 100;
     MaxMoney = 10000;
     MaxUnit  = 10;
     Farmer   = 0;
 }
Exemplo n.º 9
0
        private List <Cell> CompileFootholdCells(List <Hq> HQs)
        {
            IEnumerable <Cell> cells = new List <Cell>();

            cells = HQs.Aggregate(cells, (current, HQ) => current.Union(HQ.GetFootholdCells()));

            return(cells.ToList());
        }
Exemplo n.º 10
0
        private static void     OnGUI()
        {
            if (HQ.Settings == null)
            {
                GUILayout.Label(LC.G("ConsoleSettings_NullTarget"));
                return;
            }

            if (ConsoleSettingsEditor.menuButtonStyle == null)
            {
                ConsoleSettingsEditor.menuButtonStyle = new GUIStyle("ToolbarButton");
            }

            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Toggle(ConsoleSettingsEditor.currentTab == MainTab.General, LC.G("ConsoleSettings_General"), ConsoleSettingsEditor.menuButtonStyle) == true)
                {
                    ConsoleSettingsEditor.currentTab = MainTab.General;
                }
                if (GUILayout.Toggle(ConsoleSettingsEditor.currentTab == MainTab.Inputs, LC.G("ConsoleSettings_Inputs"), ConsoleSettingsEditor.menuButtonStyle) == true)
                {
                    ConsoleSettingsEditor.currentTab = MainTab.Inputs;
                }
                if (GUILayout.Toggle(ConsoleSettingsEditor.currentTab == MainTab.Themes, LC.G("ConsoleSettings_Themes"), ConsoleSettingsEditor.menuButtonStyle) == true)
                {
                    ConsoleSettingsEditor.currentTab = MainTab.Themes;
                }
                if (GUILayout.Toggle(ConsoleSettingsEditor.currentTab == MainTab.Presets, LC.G("ConsoleSettings_Presets"), ConsoleSettingsEditor.menuButtonStyle) == true)
                {
                    ConsoleSettingsEditor.currentTab = MainTab.Presets;
                }
            }
            GUILayout.EndHorizontal();

            EditorGUI.BeginChangeCheck();
            {
                if (ConsoleSettingsEditor.currentTab == MainTab.General)
                {
                    ConsoleSettingsEditor.OnGUIGeneral();
                }
                else if (ConsoleSettingsEditor.currentTab == MainTab.Inputs)
                {
                    ConsoleSettingsEditor.OnGUIInputs();
                }
                else if (ConsoleSettingsEditor.currentTab == MainTab.Themes)
                {
                    ConsoleSettingsEditor.OnGUIThemes();
                }
                else if (ConsoleSettingsEditor.currentTab == MainTab.Presets)
                {
                    ConsoleSettingsEditor.OnGUIPresets();
                }
            }
            if (EditorGUI.EndChangeCheck() == true)
            {
                HQ.InvalidateSettings();
            }
        }
Exemplo n.º 11
0
        public void     SaveComponents()
        {
            EditorApplication.delayCall += this.Repaint;
            HubSettings settings = HQ.Settings.Get <HubSettings>();

            Undo.RecordObject(settings, "Change HubComponent");
            settings.hubData.Serialize(this.components);
            HQ.InvalidateSettings();
        }
Exemplo n.º 12
0
 public Players(string position)
 {
     Base     = new HQ();
     Money    = 100;
     MaxMoney = 10000;
     MaxUnit  = 10;
     Farmer   = 0;
     Position = position;
 }
Exemplo n.º 13
0
 private void    OnAddSlave(ReorderableList r)
 {
     Undo.RecordObject(HQ.Settings.Get <SyncFoldersSettings>(), "Add slave");
     this.profile.slaves.Add(new Project()
     {
         folderPath = this.profile.slaves.Count > 0 ? this.profile.slaves[this.profile.slaves.Count - 1].folderPath : string.Empty
     });
     HQ.InvalidateSettings();
     this.cachedSlaves = null;
 }
Exemplo n.º 14
0
 public void ShowHQOptions(HQ hq)
 {
     CloseMenu();
     if (hq == null)
     {
         return;
     }
     MenuOpen = true;
     _hqMenu.GetComponent <HQOptionsMenu>().Open(hq);
 }
Exemplo n.º 15
0
            public override void    OnGUI(Rect r)
            {
                ScenesSettings settings = HQ.Settings.Get <ScenesSettings>();

                for (int i = 0; i < settings.profiles.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        using (BgColorContentRestorer.Get(i == this.animOn && this.anim.af.isAnimating, Color.Lerp(GUI.contentColor, OptionPopup.HighlightColor, this.anim.Value)))
                        {
                            if (GUILayout.Button("Save In", GeneralStyles.ToolbarButton, GUILayoutOptionPool.ExpandWidthFalse) == true)
                            {
                                this.animOn = i;
                                this.anim.Start();

                                settings.profiles[i].Save();
                                HQ.InvalidateSettings();
                                this.window.Repaint();
                            }

                            EditorGUI.BeginChangeCheck();
                            string name = EditorGUILayout.TextField(settings.profiles[i].name);
                            if (EditorGUI.EndChangeCheck() == true)
                            {
                                settings.profiles[i].name = name;
                                HQ.InvalidateSettings();
                            }
                        }

                        if (GUILayout.Button("X", GeneralStyles.ToolbarCloseButton, GUILayoutOptionPool.ExpandWidthFalse) == true)
                        {
                            settings.profiles.RemoveAt(i);
                            HQ.InvalidateSettings();
                            return;
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                if (GUILayout.Button("Add") == true &&
                    this.window.CheckMaxBuildSceneProfiles(settings.profiles.Count) == true)
                {
                    Profile p = new Profile()
                    {
                        name = "New"
                    };

                    p.Save();

                    settings.profiles.Add(p);

                    r.height = (settings.profiles.Count + 1) * 19F;
                    this.editorWindow.position = r;
                }
            }
Exemplo n.º 16
0
 public Board()
 {
     HQState            = new HQ();
     CityState          = new City();
     HeroDeck           = new List <Card>();
     VillainDeck        = new List <Card>();
     BadCardStacks      = new Dictionary <string, List <Card> >();
     StandardHeroStacks = new Dictionary <string, List <Card> >();
     BystanderStack     = new List <Card>();
     MastermindTactics  = new List <Card>();
     KOPile             = new List <Card>();
     EscapePile         = new List <Card>();
 }
Exemplo n.º 17
0
        private void    OnDrawHeaderSlaves(Rect r)
        {
            if (this.cachedSlaves == null)
            {
                int countActive = 0;

                for (int i = 0; i < this.profile.slaves.Count; i++)
                {
                    if (this.profile.slaves[i].active == true)
                    {
                        ++countActive;
                    }
                }

                this.cachedSlaves = new GUIContent("Slaves (" + countActive + " / " + this.profile.slaves.Count + ")");
            }

            r.width -= 100F;
            EditorGUI.BeginChangeCheck();
            this.showSlaves = EditorGUI.Foldout(r, this.showSlaves, this.cachedSlaves, true);
            if (EditorGUI.EndChangeCheck() == true)
            {
                this.slavesList.elementHeight = this.showSlaves == true ? NGSyncFoldersWindow.SlaveHeight : 0F;
                this.slavesList.displayAdd    = this.showSlaves;
            }
            r.x += r.width;

            r.width = 50F;
            if (GUI.Button(r, "All") == true)
            {
                Undo.RecordObject(HQ.Settings.Get <SyncFoldersSettings>(), "Enable all slaves");
                for (int i = 0; i < this.profile.slaves.Count; i++)
                {
                    this.profile.slaves[i].active = true;
                }
                HQ.InvalidateSettings();
                this.cachedSlaves = null;
            }
            r.x += r.width;

            if (GUI.Button(r, "None") == true)
            {
                Undo.RecordObject(HQ.Settings.Get <SyncFoldersSettings>(), "Disable all slaves");
                for (int i = 0; i < this.profile.slaves.Count; i++)
                {
                    this.profile.slaves[i].active = false;
                }
                HQ.InvalidateSettings();
                this.cachedSlaves = null;
            }
        }
Exemplo n.º 18
0
        private void    EraseProfile()
        {
            SyncFoldersSettings settings = HQ.Settings.Get <SyncFoldersSettings>();

            Undo.RecordObjects(new Object[] { settings, this }, "Erase profile");
            settings.syncProfiles.RemoveAt(this.currentProfile);
            this.UpdateCacheFiles(this.currentProfile);
            this.currentProfile           = Mathf.Clamp(this.currentProfile, 0, settings.syncProfiles.Count - 1);
            this.cachedSlaves             = null;
            this.cacheFileSize            = null;
            this.cachedFiltersFolderLabel = null;
            NGSyncFoldersWindow.cachePath = null;
            HQ.InvalidateSettings();
        }
Exemplo n.º 19
0
        private void    AddFavorite()
        {
            FavSettings settings = HQ.Settings.Get <FavSettings>();

            if (this.CheckMaxFavorites(settings.favorites.Count) == true)
            {
                Undo.RecordObject(settings, "Add favorite");
                settings.favorites.Add(new Favorites()
                {
                    name = "Favorite " + (settings.favorites.Count + 1)
                });
                this.currentSave = settings.favorites.Count - 1;
                HQ.InvalidateSettings();
            }
        }
Exemplo n.º 20
0
        private static void     AddFrameFilter(string filter)
        {
            StackTraceSettings stackTrace = HQ.Settings.Get <StackTraceSettings>();

            if (stackTrace.filters.Contains(filter) == false)
            {
                stackTrace.filters.Add(filter);
                HQ.InvalidateSettings();
                EditorUtility.DisplayDialog(Constants.PackageTitle, "\"" + filter + "\" has been added to the filters.", "OK");
            }
            else
            {
                EditorUtility.DisplayDialog(Constants.PackageTitle, "\"" + filter + "\" is already a filter.", "OK");
            }
        }
Exemplo n.º 21
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "ship")
     {
         Ship otherShip = other.GetComponent <Ship>();
         if (otherShip.getTeam() != getTeam())
         {
             //explode
             otherShip.getDamage(1, getDirection());
             DestroyBall("other");
         }
         // else if (otherShip != GetComponent<CannonBall>().getParentShip())
         // {
         //     GetComponent<CannonBall>().DestroyBall();
         // }
     }
     else if (other.tag == "dock" && cannonType == Cannon.CannonType.ship)
     {
         Dock otherDock = other.GetComponent <Dock>();
         if (otherDock.getTeam() != getTeam())
         {
             //explode
             otherDock.getDamage(1);
             DestroyBall("other");
         }
     }
     else if (other.tag == "hq" && cannonType == Cannon.CannonType.ship)
     {
         HQ otherDock = other.GetComponent <HQ>();
         if (otherDock.getTeam() != getTeam())
         {
             //explode
             otherDock.getDamage(1);
             DestroyBall("other");
         }
     }
     else if (other.tag == "water")
     {
         //play splash sound
         DestroyBall("water");
     }
     else if (other.tag == "ground")
     {
         //explode
         DestroyBall("other");
     }
 }
Exemplo n.º 22
0
        private void    CreateSelection(Object[] objects)
        {
            AssetsSelection selection = new AssetsSelection(objects);

            if (selection.refs.Count > 0)
            {
                FavSettings settings = HQ.Settings.Get <FavSettings>();

                if (this.CheckMaxAssetsPerSelection(selection.refs.Count) == true &&
                    this.CheckMaxSelections(settings.favorites[this.currentSave].favorites.Count) == true)
                {
                    Undo.RecordObject(settings, "Add Selection as favorite");
                    settings.favorites[this.currentSave].favorites.Add(selection);
                    HQ.InvalidateSettings();
                }
            }
        }
Exemplo n.º 23
0
    private void OnTriggerEnter(Collider other)
    {
        HQ dock = GetComponentInParent <HQ>();

        if (other.tag == "ship")
        {
            Ship othership = other.GetComponent <Ship>();
            if (othership.getTeam() == dock.getTeam())
            {
                dock.addAllyShip(othership);
            }
            else
            {
                dock.addEnemyShip(othership);
            }
        }
    }
Exemplo n.º 24
0
        private void    AddProfile()
        {
            SyncFoldersSettings settings = HQ.Settings.Get <SyncFoldersSettings>();

            if (this.CheckMaxSyncFoldersProfiles(settings.syncProfiles.Count) == true)
            {
                Undo.RecordObjects(new Object[] { settings, this }, "Add profile");
                settings.syncProfiles.Add(new Profile()
                {
                    name = "Profile " + (settings.syncProfiles.Count + 1)
                });
                this.currentProfile           = settings.syncProfiles.Count - 1;
                this.cachedSlaves             = null;
                this.cacheFileSize            = null;
                this.cachedFiltersFolderLabel = null;
                NGSyncFoldersWindow.cachePath = null;
                HQ.InvalidateSettings();
            }
        }
Exemplo n.º 25
0
        private static void     PickType(int i)
        {
            FullscreenBindingsSettings settings = HQ.Settings.Get <FullscreenBindingsSettings>();
            GenericTypesSelectorWizard wizard   = GenericTypesSelectorWizard.Start(NGFullscreenBindingsWindow.Title, typeof(EditorWindow), (t) =>
            {
                if (t != null)
                {
                    settings.bindings[i].type = t.GetShortAssemblyType();
                }
                else
                {
                    settings.bindings[i].type = string.Empty;
                }
                HQ.InvalidateSettings();
                Utility.RepaintEditorWindow(typeof(NGSettingsWindow));
            }, true, true);

            wizard.EnableNullValue = true;
            wizard.SelectedType    = Type.GetType(settings.bindings[i].type);
        }
Exemplo n.º 26
0
 public bool DepositGold(HQ hq)
 {
     if (hq)
     {
         if (hq.DepositGold(this))
         {
             Debug.Log("Miner::Deposit. Depositing");
             return(true);
         }
         else
         {
             Debug.Log("Miner::Deposit. Couldn't deposit.");
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 27
0
        private static void     OnGUISettings()
        {
            if (HQ.Settings == null)
            {
                return;
            }

            if (DragObjectDrawer.ScriptAttributeUtility == null)
            {
                EditorGUILayout.HelpBox("NG Tools has detected a change in Unity code. Please contact the author.", MessageType.Error);

                if (GUILayout.Button("Contact the author") == true)
                {
                    ContactFormWizard.Open(ContactFormWizard.Subject.BugReport, "DragObjectDrawer is incompatible with " + Utility.UnityVersion + ".");
                }
                return;
            }

            DraggableObjectSettings settings = HQ.Settings.Get <DraggableObjectSettings>();

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Allows to drag & drop between Object fields in Inspector.", GeneralStyles.WrapLabel);
            bool active = EditorGUILayout.Toggle("Drag & Drop with Object", settings.active);

            if (EditorGUI.EndChangeCheck() == true)
            {
                HQ.InvalidateSettings();

                if (active == true)
                {
                    DragObjectDrawer.AddType();
                }
                else
                {
                    DragObjectDrawer.RemoveType();
                }

                settings.active = active;
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Adds newly created child department to parent department
        /// </summary>
        /// <param name="pd">Parent department</param>
        /// <param name="childDeptName">Name of the department to be created</param>
        /// <param name="childDeptCreationDate">Child department creation date</param>
        public IDepartmentDTO CreateDepartment(IDepartmentDTO pd, string childDeptName, DateTime childDeptCreationDate)
        {
            BaseDepartment parentDept = pd as BaseDepartment;
            BaseDepartment childDept;

            // Creation of root department
            // it means childDept is root department
            if (parentDept == null)
            {
                childDept           = new HQ(childDeptName);
                childDept.CreatedOn = childDeptCreationDate;
                Departments.Add(childDept);
                return(childDept as IDepartmentDTO);
            }

            // Create Division level department
            uint rootDeptID = RootDepartment().DeptID;

            if (parentDept.DeptID == rootDeptID)
            {
                childDept = new Division(childDeptName, rootDeptID)
                {
                    CreatedOn = childDeptCreationDate
                };
                Departments.Add(childDept);
                parentDept.SubDepts.Add(childDept.DeptID);
                childDept.ParentDeptID = parentDept.DeptID;
                return(childDept as IDepartmentDTO);
            }

            // Create Department level department
            childDept = new Department(childDeptName, parentDept.DeptID)
            {
                CreatedOn = childDeptCreationDate
            };
            Departments.Add(childDept);
            parentDept.SubDepts.Add(childDept.DeptID);
            childDept.ParentDeptID = parentDept.DeptID;
            return(childDept as IDepartmentDTO);
        }
Exemplo n.º 29
0
        private void    DelayedRefreshStreams()
        {
            NGConsoleWindow[] consoles = Resources.FindObjectsOfTypeAll <NGConsoleWindow>();

            if (consoles.Length == 0)
            {
                return;
            }

            MainModule main = consoles[0].GetModule("Main") as MainModule;

            if (main != null)
            {
                for (int i = 0; i < main.Streams.Count; i++)
                {
                    main.Streams[i].RefreshFilteredRows();
                }

                HQ.InvalidateSettings();
                Utility.RepaintEditorWindow(typeof(NGConsoleWindow));
            }
        }
Exemplo n.º 30
0
        protected virtual void  OnEnable()
        {
            Utility.RestoreIcon(this, NGFavWindow.TitleColor);

            Metrics.UseTool(3);             // NGFav

            NGChangeLogWindow.CheckLatestVersion(NGAssemblyInfo.Name);

            this.wantsMouseMove = true;

            this.minSize = new Vector2(this.minSize.x, 0F);

            this.horizontalScrolls = new List <HorizontalScrollbar>();
            this.delayToDelete     = -1;

            this.list = new ReorderableList(null, typeof(GameObject), true, false, false, false);
            this.list.showDefaultBackground = false;
            this.list.headerHeight          = 0F;
            this.list.footerHeight          = 0F;
            this.list.drawElementCallback   = this.DrawElement;
            this.list.onReorderCallback     = (ReorderableList list) => { HQ.InvalidateSettings(); };

            if (this.backgroundColor.a == 0F)
            {
                this.backgroundColor = (Color)Utility.LoadEditorPref(this.backgroundColor, typeof(Color), "NGFav.backgroundColor");
            }

            NGDiagnostic.DelayDiagnostic(this.Diagnose);

            HQ.SettingsChanged += this.CheckSettings;
            Utility.RegisterIntervalCallback(this.TryReconnectkNullObjects, NGFavWindow.ForceRepaintRefreshTick);
            RootGameObjectsManager.RootChanged += this.OnRootObjectsChanged;
            Undo.undoRedoPerformed             += this.Repaint;

            this.CheckSettings();
        }
Exemplo n.º 31
0
 public static HQ getInstance()
 {
     if(inst == null)inst = new HQ();
     return inst;
 }
Exemplo n.º 32
0
    void SelectUI()
    {
        if (!HasSelection())
        {
            return;
        }
        SelectionData Single = CurrentSelectionObjects[0];

        if (Single.IsWorker())
        {
            if (_hit.transform.tag == TagLibrary.HQ_TAG)
            {
                //RadialMenuScript.instance.ShowToolOptions(Single._Worker, _hit.transform.position);
                if (_hit.transform.GetComponent <Tile>() != null || _hit.transform.GetComponent <HQTileTagScript>() != null)
                {
                    ExecuteOrderOnAll(UnitTask.TaskType.Walk);
                }
            }
            else if (_hit.transform.tag == TagLibrary.VEHICLE_TAG)
            {
                if (!_hit.transform.GetComponent <Vehicle>().GetOccupied())
                {
                    RadialMenuScript.instance.ShowEmptyVehicleOptions(Single._Worker, _hit.transform.GetComponent <Vehicle>());
                }
            }
            else if (_hit.transform.tag == TagLibrary.WORKER_TAG)
            {
                Worker        worker  = _hit.transform.gameObject.GetComponentInParent <Worker>();
                List <Worker> workers = new List <Worker>();
                for (int i = 0; i < CurrentSelectionObjects.Count; i++)
                {
                    workers.Add(CurrentSelectionObjects[i]._Worker);
                }
                RadialMenuScript.instance.ShowWorkerOptions(workers, worker);
            }
            else
            {
                ExecuteOrderOnAll(UnitTask.TaskType.Walk);
            }
        }
        else
        {
            switch (_hit.transform.tag)
            {
            case TagLibrary.ROCK_TAG:
                RockScript rock = _hit.transform.gameObject.GetComponentInParent <RockScript>();
                RadialMenuScript.instance.ShowRockOptions(rock);
                break;

            case TagLibrary.RUBBLE_TAG:
                RubbleScript rubble = _hit.transform.gameObject.GetComponentInParent <RubbleScript>();
                RadialMenuScript.instance.ShowRubbleOptions(rubble);
                break;

            case TagLibrary.MONSTER_TAG:
                Monster monster = _hit.transform.GetComponentInParent <Monster>();
                RadialMenuScript.instance.ShowEnemyOptions(monster);
                break;

            case TagLibrary.HQ_TAG:
                HQ hq = _hit.transform.GetComponentInParent <HQ>();
                RadialMenuScript.instance.ShowHQOptions(hq);
                break;

            case TagLibrary.OUTPOST_TAG:
                Outpost outpost = _hit.transform.GetComponentInParent <Outpost>();
                RadialMenuScript.instance.ShowOutpostOptions(outpost);
                break;

            case TagLibrary.GARAGE_TAG:
                Garage garage = _hit.transform.GetComponentInParent <Garage>();
                RadialMenuScript.instance.ShowGarageOptions(garage);
                break;

            case TagLibrary.GEN_TAG:
            case TagLibrary.SKIP_TAG:
            case TagLibrary.BLOCK_TAG:
            case TagLibrary.TURRET_TAG:
            case TagLibrary.POWERGEN_TAG:
                Building building = _hit.transform.GetComponentInParent <Building>();
                RadialMenuScript.instance.ShowBuildingOptions(building);
                break;

            case TagLibrary.ORE_TAG:
                Ore ore = _hit.transform.GetComponentInParent <Ore>();
                RadialMenuScript.instance.ShowResourceOptionsOre(ore);
                break;

            case TagLibrary.ENERGYCRYSTAL_TAG:
                EnergyCrystal energyCrystal = _hit.transform.GetComponentInParent <EnergyCrystal>();
                RadialMenuScript.instance.ShowResourceOptionsEnergyCrystal(energyCrystal);
                break;

            case TagLibrary.VEHICLE_TAG:
                Vehicle vehicle = _hit.transform.GetComponent <Vehicle>();
                if (vehicle.GetOccupied())
                {
                    RadialMenuScript.instance.ShowVehicleOptions(_hit.transform.GetComponent <Vehicle>());
                }
                else
                {
                    RadialMenuScript.instance.ShowEmptyVehicleOptions(null, _hit.transform.GetComponent <Vehicle>());
                }
                break;

            case TagLibrary.BURN_TAG:
                MushroomCluster mushroomCluster = _hit.transform.GetComponentInParent <MushroomCluster>();
                RadialMenuScript.instance.ShowMushroomOptions(mushroomCluster);
                break;
            }
        }
        if (!Single.IsWorker())
        {
            ClearSelectedObjects(false);
        }
        SetMode(CurrentSelectionMode.RadialMenu);
    }
Exemplo n.º 33
0
 void Awake()
 {
     inst = this;
 }