示例#1
0
    public void Start()
    {
        // Create GameObject so we can have access to a transform which has a position of "Vector3.zero".
        new GameObject("VisualPath", typeof(VisualPath));
        GameObject go;

        tileSpriteController      = new TileSpriteController(World);
        characterSpriteController = new CharacterSpriteController(World);
        furnitureSpriteController = new FurnitureSpriteController(World);
        utilitySpriteController   = new UtilitySpriteController(World);
        jobSpriteController       = new JobSpriteController(World, furnitureSpriteController, utilitySpriteController);
        inventorySpriteController = new InventorySpriteController(World, inventoryUI);
        shipSpriteController      = new ShipSpriteController(World);

        buildModeController      = new BuildModeController();
        spawnInventoryController = new SpawnInventoryController();
        mouseController          = new MouseController(buildModeController, furnitureSpriteController, utilitySpriteController, circleCursorPrefab);
        questController          = new QuestController();
        cameraController         = new CameraController();
        TradeController          = new TradeController();
        autosaveManager          = new AutosaveManager();

        dialogBoxManager = GameObject.Find("Dialog Boxes").GetComponent <DialogBoxManager>();

        // Register inputs actions
        KeyboardManager.Instance.RegisterInputAction("DevMode", KeyboardMappedInputType.KeyDown, ChangeDevMode);

        // Hiding Dev Mode spawn inventory controller if devmode is off.
        spawnInventoryController.SetUIVisibility(Settings.GetSetting("DialogBoxSettingsDevConsole_developerModeToggle", false));

        cameraController.Initialize();
        cameraController.Moved += this.World.OnCameraMoved;

        // Initialising controllers.
        GameObject canvas = GameObject.Find("Canvas");

        go      = Instantiate(Resources.Load("UI/ContextMenu"), canvas.transform.position, canvas.transform.rotation, canvas.transform) as GameObject;
        go.name = "ContextMenu";

        GameController.Instance.IsModal = false;

        GameObject devConsole = (GameObject)Instantiate(Resources.Load("UI/Console/DevConsole"));

        // This is just to make sure it isn't null (the static thing shouldn't destroy this copy but in some edge cases it might decide to).
        if (devConsole != null)
        {
            devConsole.name = "DevConsole-Spawned";
            devConsole.transform.SetParent(canvas.transform, false);
            devConsole.transform.SetAsLastSibling();
            devConsole.SetActive(true);
            DeveloperConsole.DevConsole.Close();
        }
    }
    public void Start()
    {
        // Create GameObject so we can have access to a transform which has a position of "Vector3.zero".
        new GameObject("VisualPath", typeof(VisualPath));
        GameObject go;

        tileSpriteController      = new TileSpriteController(World);
        characterSpriteController = new CharacterSpriteController(World);
        furnitureSpriteController = new FurnitureSpriteController(World);
        utilitySpriteController   = new UtilitySpriteController(World);
        jobSpriteController       = new JobSpriteController(World, furnitureSpriteController, utilitySpriteController);
        inventorySpriteController = new InventorySpriteController(World, inventoryUI);
        shipSpriteController      = new ShipSpriteController(World);

        buildModeController      = new BuildModeController();
        spawnInventoryController = new SpawnInventoryController();
        mouseController          = new MouseController(buildModeController, furnitureSpriteController, utilitySpriteController, circleCursorPrefab);
        questController          = new QuestController();
        cameraController         = new CameraController();
        TradeController          = new TradeController();
        autosaveManager          = new AutosaveManager();

        dialogBoxManager = GameObject.Find("Dialog Boxes").GetComponent <DialogBoxManager>();

        // Register inputs actions
        KeyboardManager.Instance.RegisterInputAction("DevMode", KeyboardMappedInputType.KeyDown, ChangeDevMode);

        // Hiding Dev Mode spawn inventory controller if devmode is off.
        spawnInventoryController.SetUIVisibility(Settings.GetSetting("DialogBoxSettings_developerModeToggle", false));

        cameraController.Initialize();
        cameraController.Moved += this.World.OnCameraMoved;

        // Initialising controllers.
        GameObject canvas = GameObject.Find("Canvas");

        go      = Instantiate(Resources.Load("UI/ContextMenu"), canvas.transform.position, canvas.transform.rotation, canvas.transform) as GameObject;
        go.name = "ContextMenu";

        GameController.Instance.IsModal = false;
    }
    public void Start()
    {
        // Create gameobject so we can have access to a tranform thats position is "Vector3.zero".
        new GameObject("VisualPath", typeof(VisualPath));
        GameObject go;

        tileSpriteController      = new TileSpriteController(World);
        characterSpriteController = new CharacterSpriteController(World);
        furnitureSpriteController = new FurnitureSpriteController(World);
        jobSpriteController       = new JobSpriteController(World, furnitureSpriteController);
        inventorySpriteController = new InventorySpriteController(World, inventoryUI);

        buildModeController      = new BuildModeController();
        spawnInventoryController = new SpawnInventoryController();
        mouseController          = new MouseController(buildModeController, furnitureSpriteController, circleCursorPrefab);
        keyboardManager          = KeyboardManager.Instance;
        questController          = new QuestController();
        cameraController         = new CameraController();
        TradeController          = new TradeController();
        timeManager     = new TimeManager();
        autosaveManager = new AutosaveManager();

        keyboardManager.RegisterInputAction("Pause", KeyboardMappedInputType.KeyUp, () => { IsPaused = !IsPaused; });

        // Hiding Dev Mode spawn inventory controller if devmode is off.
        spawnInventoryController.SetUIVisibility(Settings.GetSetting("DialogBoxSettings_developerModeToggle", false));

        // Initialising controllers.
        GameObject controllers = GameObject.Find("Controllers");

        Instantiate(Resources.Load("UIController"), controllers.transform);

        GameObject canvas = GameObject.Find("Canvas");

        go      = Instantiate(Resources.Load("UI/ContextMenu"), canvas.transform.position, canvas.transform.rotation, canvas.transform) as GameObject;
        go.name = "ContextMenu";
    }
示例#4
0
    public void Start()
    {
        // Create GameObject so we can have access to a transform which has a position of "Vector3.zero".
        new GameObject("VisualPath", typeof(VisualPath));
        GameObject go;

        tileSpriteController      = new TileSpriteController(World);
        characterSpriteController = new CharacterSpriteController(World);
        furnitureSpriteController = new FurnitureSpriteController(World);
        utilitySpriteController   = new UtilitySpriteController(World);
        jobSpriteController       = new JobSpriteController(World, furnitureSpriteController, utilitySpriteController);
        inventorySpriteController = new InventorySpriteController(World, inventoryUI);
        shipSpriteController      = new ShipSpriteController(World);

        buildModeController      = new BuildModeController();
        spawnInventoryController = new SpawnInventoryController();
        mouseController          = new MouseController(buildModeController, furnitureSpriteController, utilitySpriteController, circleCursorPrefab);
        questController          = new QuestController();
        cameraController         = new CameraController();
        TradeController          = new TradeController();
        autosaveManager          = new AutosaveManager();

        // Register inputs actions
        KeyboardManager.Instance.RegisterInputAction("DevMode", KeyboardMappedInputType.KeyDown, ChangeDevMode);

        // Hiding Dev Mode spawn inventory controller if devmode is off.
        spawnInventoryController.SetUIVisibility(Settings.GetSetting("DialogBoxSettingsDevConsole_developerModeToggle", false));

        cameraController.Initialize();
        cameraController.Moved += this.World.OnCameraMoved;

        // Initialising controllers.
        GameObject canvas = GameObject.Find("Canvas");

        go      = Instantiate(Resources.Load("UI/ContextMenu"), canvas.transform.position, canvas.transform.rotation, canvas.transform) as GameObject;
        go.name = "ContextMenu";

        GameController.Instance.IsModal = false;

        // Settings UI is a 'dialog box' (kinda), so it comes here.
        // Where as DevConsole is a constant menu item (it can appear 'anywhere' so it appears after)
        GameObject settingsMenu = (GameObject)Instantiate(Resources.Load("UI/SettingsMenu/SettingsMenu"));

        if (settingsMenu != null)
        {
            settingsMenu.name = "Settings Menu";
            settingsMenu.transform.SetParent(canvas.transform, false);
            settingsMenu.SetActive(true);
        }

        // This will place it after context menu (and the inventory menu) and settings menu
        dialogBoxManager = GameObject.Find("Dialog Boxes").GetComponent <DialogBoxManager>();
        dialogBoxManager.transform.SetAsLastSibling();

        GameObject devConsole = (GameObject)Instantiate(Resources.Load("UI/Console/DevConsole"));

        if (devConsole != null)
        {
            devConsole.name = "DevConsole-Spawned";
            devConsole.transform.SetParent(canvas.transform, false);
            devConsole.transform.SetAsLastSibling();
            devConsole.SetActive(true);
            DeveloperConsole.DevConsole.Close();
        }
    }
    public void Start()
    {
        // Create GameObject so we can have access to a transform which has a position of "Vector3.zero".
        GameObject go;

        TileSpriteController      = new TileSpriteController(World);
        CharacterSpriteController = new CharacterSpriteController(World);
        FurnitureSpriteController = new FurnitureSpriteController(World);
        UtilitySpriteController   = new UtilitySpriteController(World);
        JobSpriteController       = new JobSpriteController(World, FurnitureSpriteController, UtilitySpriteController);
        InventorySpriteController = new InventorySpriteController(World, inventoryUI);
        ShipSpriteController      = new ShipSpriteController(World);

        BuildModeController      = new BuildModeController();
        SpawnInventoryController = new SpawnInventoryController();
        MouseController          = new MouseController();
        QuestController          = new QuestController();
        CameraController         = new CameraController();
        TradeController          = new TradeController();
        AutosaveManager          = new AutosaveManager();

        MouseController.RegisterModeHandler(MouseMode.BUILD, BuildModeController);
        MouseController.RegisterModeHandler(MouseMode.INVENTORY, SpawnInventoryController);

        // Register inputs actions
        KeyboardManager.Instance.RegisterInputAction("DevMode", KeyboardMappedInputType.KeyDown, ChangeDevMode);

        // Hiding Dev Mode spawn inventory controller if devmode is off.
        SpawnInventoryController.SetUIVisibility(SettingsKeyHolder.DeveloperMode);

        CameraController.Initialize();

        // Initialising controllers.
        GameObject canvas = GameObject.Find("Canvas");

        go      = Instantiate(Resources.Load("UI/ContextMenu"), canvas.transform.position, canvas.transform.rotation, canvas.transform) as GameObject;
        go.name = "ContextMenu";

        GameObject timeScale = Instantiate(Resources.Load("UI/TimeScale"), GameObject.Find("TopRight").transform, false) as GameObject;

        timeScale.name = "TimeScale";

        GameObject dateTimeDisplay = Instantiate(Resources.Load("UI/DateTimeDisplay"), canvas.transform, false) as GameObject;

        dateTimeDisplay.name = "DateTimeDisplay";

        GameController.Instance.IsModal = false;

        // Settings UI is a 'dialog box' (kinda), so it comes here.
        // Where as DevConsole is a constant menu item (it can appear 'anywhere' so it appears after)
        GameObject settingsMenu = (GameObject)Instantiate(Resources.Load("UI/SettingsMenu/SettingsMenu"));

        if (settingsMenu != null)
        {
            settingsMenu.name = "Settings Menu";
            settingsMenu.transform.SetParent(canvas.transform, false);
            settingsMenu.SetActive(true);
        }

        // This will place it after context menu (and the inventory menu) and settings menu
        DialogBoxManager = GameObject.Find("Dialog Boxes").GetComponent <DialogBoxManager>();
        DialogBoxManager.transform.SetAsLastSibling();

        GameObject devConsole = (GameObject)Instantiate(Resources.Load("UI/Console/DevConsole"));

        if (devConsole != null)
        {
            devConsole.name = "DevConsole-Spawned";
            devConsole.transform.SetParent(canvas.transform, false);
            devConsole.transform.SetAsLastSibling();
            devConsole.SetActive(true);
            DeveloperConsole.DevConsole.Close();
        }
    }