public void Setup()
        {
            Instance = this;

            comms = new CommunicationNode();
            comms.EnableNode(this);
        }
Esempio n. 2
0
        public static Ship CreateShipAtCommNode(Core instance, User user, CommunicationNode node)
        {
            var   TargetRegionId = GeometryIndex.calcRegionId(node.positionX, node.positionY);
            Field Field          = GeometryIndex.regions[TargetRegionId].findOrCreateField(node.positionX, node.positionY);

            return(CreateShipAtField(instance, user, Field));
        }
        public void Unload()
        {
            GameObject.Destroy(loadingBar);
            GameObject.Destroy(loadingButton);
            GameObject.Destroy(loadingRoot);
            GameObject.Destroy(optionsUIManager);

            //destroys all menu items (ModOptions)
            GameObject.Destroy(optionsMenuScreen);
            modOptions = null;
            backButton = null;

            optionsMenuScreen = null;
            optionsUIManager  = null;
            loadingBar        = null;
            loadingButton     = null;
            loadingRoot       = null;

            rootUIManager = null;

            loadingButtonPressed = false;

            UnityEngine.SceneManagement.SceneManager.sceneLoaded -= SceneLoaded;

            comms.DisableNode();
            comms    = null;
            Instance = null;
        }
Esempio n. 4
0
        public override void Initialize()
        {
            if (Instance != null)
            {
                Log("Warning: " + this.GetType().Name + " is a singleton. Trying to create more than one may cause issues!");
                return;
            }

            Instance = this;
            comms    = new CommunicationNode();
            comms.EnableNode(this);

            //Must manually set these for them to show up in the config file
            //I know this looks super wonky but it's the current best way to handle this
            GlobalSettings.GatheringSwarmChanges = GlobalSettings.GatheringSwarmChanges;
            GlobalSettings.WaywardCompassChanges = GlobalSettings.WaywardCompassChanges;
            GlobalSettings.HeavyBlowChanges      = GlobalSettings.HeavyBlowChanges;

            Log(this.GetType().Name + " initializing!");

            SetupDefaulSettings();

            UnRegisterCallbacks();
            RegisterCallbacks();

            Log(this.GetType().Name + " is done initializing!");
        }
Esempio n. 5
0
        private Ship createShipAtCommNode(User user, CommunicationNode node)
        {
            SpacegameServer.Core.ShipBuild builder = new ShipBuild(instance);
            int          newShipId = (int)instance.identities.shipLock.getNext();
            ShipTemplate template  = instance.shipTemplate.Where(e => e.Value.hullid == 1).First().Value;

            var    targetRegionId = GeometryIndex.calcRegionId(node.positionX, node.positionY);
            Field  field          = GeometryIndex.regions[targetRegionId].findOrCreateField(node.positionX, node.positionY);
            Colony colony         = Mock.mockColony(ColonyUserId: user.id);
            Ship   newShip        = builder.buildShip(newShipId, template, field, user.id, colony, false);

            return(newShip);
        }
        public void Setup()
        {
            Dev.Where();

            Instance = this;
            comms    = new CommunicationNode();
            comms.EnableNode(this);

            UnityEngine.SceneManagement.SceneManager.sceneLoaded -= SceneLoaded;
            UnityEngine.SceneManagement.SceneManager.sceneLoaded += SceneLoaded;

            Dev.Log("Menu Loaded!");
        }
        public override void Initialize()
        {
            if (Instance != null)
            {
                Log("Warning: EnemyRandomizer is a singleton. Trying to create more than one may cause issues!");
                return;
            }

            Instance = this;
            comms    = new CommunicationNode();
            comms.EnableNode(this);

            Log("Enemy Randomizer Mod initializing!");

            SetupDefaulSettings();

            UnRegisterCallbacks();
            RegisterCallbacks();

            //create the database that will hold all the loaded enemies
            if (database == null)
            {
                database = new EnemyRandomizerDatabase();
            }

            if (logic == null)
            {
                logic = new EnemyRandomizerLogic(database);
            }

            //create the loader which will handle loading all the enemy types in the game
            if (loader == null)
            {
                loader = new EnemyRandomizerLoader(database);
            }

            //Create all mod UI elements and their manager
            if (menu == null)
            {
                menu = new Menu.RandomizerMenu();
            }

            database.Setup();
            loader.Setup();
            menu.Setup();

            ContractorManager.Instance.StartCoroutine(DebugInput());
        }
Esempio n. 8
0
        public void getCommNodes(SpacegameServer.Core.Core _core)
        {
            var commNodeId  = (int)_core.identities.commNode.getNext();
            int DefaultUser = 0;

            CommunicationNode node = new CommunicationNode(commNodeId);

            node.userId    = DefaultUser;
            node.positionX = 5000;
            node.positionY = 5000;

            node.sysX = null;
            node.sysY = null;

            node.connectionType  = 0;
            node.connectionId    = _core.ships.First().Key;
            node.activ           = true;
            node.unformattedName = "";
            node.name            = "";

            _core.commNodes.TryAdd(commNodeId, node);
            SpacegameServer.Core.NodeQuadTree.Field commNodeField = new SpacegameServer.Core.NodeQuadTree.Field(node.positionX, node.positionY);
            _core.nodeQuadTree.insertNode(commNodeField, node.id);


            commNodeId     = (int)_core.identities.commNode.getNext();
            node           = new CommunicationNode(commNodeId);
            node.userId    = DefaultUser;
            node.positionX = 5001;
            node.positionY = 5001;

            node.sysX = null;
            node.sysY = null;

            node.connectionType  = 0;
            node.connectionId    = _core.ships[1].id;
            node.activ           = true;
            node.unformattedName = "";
            node.name            = "";

            _core.commNodes.TryAdd(commNodeId, node);
            commNodeField = new SpacegameServer.Core.NodeQuadTree.Field(node.positionX, node.positionY);
            _core.nodeQuadTree.insertNode(commNodeField, node.id);
        }
Esempio n. 9
0
        public override void Initialize()
        {
            if (Instance != null)
            {
                Log("Warning: " + this.GetType().Name + " is a singleton. Trying to create more than one may cause issues!");
                return;
            }

            Instance = this;
            comms    = new CommunicationNode();
            comms.EnableNode(this);

            Log(this.GetType().Name + " initializing!");

            SetupDefaulSettings();

            UnRegisterCallbacks();
            RegisterCallbacks();
        }