Ejemplo n.º 1
0
    public ScenarioPlayScreen(Scenario selectedScenario)
    {
        //CommandIcon = ResourceManager.instance.GetIconTexture("Icon_CommandPoint");
        //MoneyIcon = ResourceManager.instance.GetIconTexture("Icon_Money");

        PlayerFleet  = new FleetData();
        EnemyFleet   = new FleetData();
        AlliedFleet  = new FleetData();
        NeutralFleet = new FleetData();

        PlayerShipManager  = new ShipManager(true, PlayerFleet, 9);
        EnemyShipManager   = new ShipManager(false, EnemyFleet, 10);
        AlliedShipManager  = new ShipManager(false, AlliedFleet, 11);
        NeutralShipManager = new ShipManager(false, NeutralFleet, 13);

        ShipManagers.Add(PlayerShipManager);
        ShipManagers.Add(EnemyShipManager);
        ShipManagers.Add(AlliedShipManager);
        ShipManagers.Add(NeutralShipManager);

        PlayerShipManager.SetPause(true);
        EnemyShipManager.SetPause(true);
        AlliedShipManager.SetPause(true);
        NeutralShipManager.SetPause(true);
        EnemyShipManager.SetAI(true);
        AlliedShipManager.SetAI(true);

        //Set Combat diplomacy
        PlayerShipManager.AddEnemyShipManager(EnemyShipManager);
        PlayerShipManager.AddAlliedShipManager(AlliedShipManager);
        EnemyShipManager.AddEnemyShipManager(PlayerShipManager);
        EnemyShipManager.AddEnemyShipManager(AlliedShipManager);
        AlliedShipManager.AddEnemyShipManager(EnemyShipManager);
        AlliedShipManager.AddAlliedShipManager(PlayerShipManager);

        shipDragSelectionBox = new ShipDragSelectionBox();

        float toolTipWidth = Screen.width * 0.175f;

        ToolTip = new GUIToolTip(new Vector2(Screen.width - toolTipWidth, 0), toolTipWidth);

        float MiniMapSize = Screen.height * 0.2f;
        Rect  miniMapRect = new Rect(Screen.width - Screen.height * 0.215f, Screen.height - Screen.height * 0.215f, MiniMapSize, MiniMapSize);

        miniMap = new MiniMap(miniMapRect, GameManager.instance.miniMapTexture, ToolTip);
        float GameSpeedButtonSize = miniMapRect.width / 5f;

        gameSpeedButton = new GameSpeedButton(new Rect(miniMapRect.x - GameSpeedButtonSize, miniMapRect.yMax - GameSpeedButtonSize, GameSpeedButtonSize, GameSpeedButtonSize), ToolTip);

        Vector2 shipPanelSize = new Vector2(Screen.width * 0.5f, Screen.height * 0.25f);

        shipInfoPanel = new ShipCombatInfoPanel(this, new Rect(new Vector2((Screen.width - shipPanelSize.x) / 2, Screen.height - shipPanelSize.y), shipPanelSize), PlayerShipManager, ToolTip);

        SetupPanel = new Rect(0, 0, Screen.width * 0.25f, Screen.height * 0.6f);

        Rect battleTimerRect = new Rect(Screen.width * 0.475f, 0, Screen.width * 0.05f, Screen.height * 0.03f);

        combatTimer = new CombatTimer(battleTimerRect, ToolTip);

        shipHullList = new ShipHullScrollList(new Rect(SetupPanel.width * 0.1f, SetupPanel.height * 0.01f, SetupPanel.width * 0.8f, SetupPanel.height * 0.375f), ChangeHull, CheckHullValid);

        DesignScrollWindowRect = new Rect(shipHullList.getRect().x, shipHullList.getRect().yMax + SetupPanel.height * 0.01f, shipHullList.getRect().width, shipHullList.getRect().height);
        DesignScrollViewRect   = new Rect(0, 0, DesignScrollWindowRect.width * 0.92f, DesignScrollWindowRect.height * 1.02f);
        DesignScrollPostion    = Vector2.zero;

        CommandRect     = new Rect((SetupPanel.width - GameManager.instance.StandardLabelSize.x) / 2f, DesignScrollWindowRect.yMax + SetupPanel.height * 0.01f, GameManager.instance.StandardLabelSize.x, GameManager.instance.StandardLabelSize.y);
        MoneyRect       = new Rect(CommandRect.x, CommandRect.yMax + SetupPanel.height * 0.01f, GameManager.instance.StandardLabelSize.x, GameManager.instance.StandardLabelSize.y);
        StartButtonRect = new Rect((SetupPanel.width - GameManager.instance.StandardButtonSize.x * 2) / 4f, MoneyRect.yMax + SetupPanel.height * 0.01f, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        BackButtonRect  = new Rect((SetupPanel.width / 2f) + (SetupPanel.width - GameManager.instance.StandardButtonSize.x * 2) / 4f, StartButtonRect.y, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);

        //Summary
        SummaryScrollList = new CombatSummaryScrollList();

        //Pause
        Vector2 pauseButtonSize = new Vector2(Screen.width * 0.078125f, Screen.height * 0.037037f);

        ContinueButtonRect = new Rect((Screen.width - pauseButtonSize.x) / 2f, Screen.height / 3.5f, pauseButtonSize.x, pauseButtonSize.y);
        QuitButtonRect     = new Rect(ContinueButtonRect.x, ContinueButtonRect.yMax, pauseButtonSize.x, pauseButtonSize.y);

        shipHullList.CheckFirstHull(ChangeHull);

        LoadScenario(selectedScenario);
    }
Ejemplo n.º 2
0
    public CustomBattleScreen()
    {
        ShipSelectionRect = new Rect(0, 0, Screen.width * 0.25f, Screen.height * 0.65f);

        shipHullList = new ShipHullScrollList(new Rect(ShipSelectionRect.width * 0.05f, ShipSelectionRect.height * 0.025f, ShipSelectionRect.width * .9f, ShipSelectionRect.height * 0.25f), ChangeHull, CheckHullValid);

        DesignScrollWindowRect = new Rect(shipHullList.getRect().x, shipHullList.getRect().yMax + Screen.height * 0.025f, shipHullList.getRect().width, shipHullList.getRect().height);
        DesignScrollViewRect   = new Rect(0, 0, DesignScrollWindowRect.width * 0.92f, DesignScrollWindowRect.height + 1);
        DesignScrollPostion    = Vector2.zero;

        OwnerPlayerButtonRect  = new Rect(ShipSelectionRect.width / 2 - GameManager.instance.StandardButtonSize.x / 2, DesignScrollWindowRect.yMax + GameManager.instance.StandardButtonSize.y, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        OwnerEnemyButtonRect   = new Rect(OwnerPlayerButtonRect.x, OwnerPlayerButtonRect.yMax, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        OwnerAlliedButtonRect  = new Rect(OwnerPlayerButtonRect.x, OwnerEnemyButtonRect.yMax, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        OwnerNeutralButtonRect = new Rect(OwnerPlayerButtonRect.x, OwnerAlliedButtonRect.yMax, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);

        StartButtonRect = new Rect(OwnerPlayerButtonRect.x, ShipSelectionRect.yMax - GameManager.instance.StandardButtonSize.y * 2, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);

        PlayerFleet  = new FleetData();
        EnemyFleet   = new FleetData();
        AlliedFleet  = new FleetData();
        NeutralFleet = new FleetData();

        PlayerShipManager  = new ShipManager(true, PlayerFleet, 9);
        EnemyShipManager   = new ShipManager(false, EnemyFleet, 10);
        AlliedShipManager  = new ShipManager(false, AlliedFleet, 11);
        NeutralShipManager = new ShipManager(false, NeutralFleet, 13);

        ShipManagers.Add(PlayerShipManager);
        ShipManagers.Add(EnemyShipManager);
        ShipManagers.Add(AlliedShipManager);
        ShipManagers.Add(NeutralShipManager);

        PlayerShipManager.SetPause(true);
        EnemyShipManager.SetPause(true);
        AlliedShipManager.SetPause(true);
        NeutralShipManager.SetPause(true);
        EnemyShipManager.SetAI(true);
        AlliedShipManager.SetAI(true);

        //Set Combat diplomacy
        PlayerShipManager.AddEnemyShipManager(EnemyShipManager);
        PlayerShipManager.AddAlliedShipManager(AlliedShipManager);
        EnemyShipManager.AddEnemyShipManager(PlayerShipManager);
        EnemyShipManager.AddEnemyShipManager(AlliedShipManager);
        AlliedShipManager.AddEnemyShipManager(EnemyShipManager);
        AlliedShipManager.AddAlliedShipManager(PlayerShipManager);

        shipDragSelectionBox = new ShipDragSelectionBox();

        float toolTipWidth = Screen.width * 0.175f;

        ToolTip = new GUIToolTip(new Vector2(Screen.width - toolTipWidth, 0), toolTipWidth);

        Vector2 shipPanelSize = new Vector2(Screen.width * 0.5f, Screen.height * 0.25f);

        shipInfoPanel = new ShipCombatInfoPanel(this, new Rect(new Vector2((Screen.width - shipPanelSize.x) / 2, Screen.height - shipPanelSize.y), shipPanelSize), PlayerShipManager, ToolTip);

        float MiniMapSize = Screen.height * 0.2f;
        Rect  miniMapRect = new Rect(Screen.width - Screen.height * 0.215f, Screen.height - Screen.height * 0.215f, MiniMapSize, MiniMapSize);

        miniMap = new MiniMap(miniMapRect, GameManager.instance.miniMapTexture, ToolTip);
        float GameSpeedButtonSize = miniMapRect.width / 5f;

        gameSpeedButton = new GameSpeedButton(new Rect(miniMapRect.x - GameSpeedButtonSize, miniMapRect.yMax - GameSpeedButtonSize, GameSpeedButtonSize, GameSpeedButtonSize), ToolTip);

        Rect fleetCombatInfoPanelRect = new Rect(0, Screen.height - shipPanelSize.y, shipPanelSize.y, shipPanelSize.y);

        fleetCombatInfoPanel = new FleetCombatInfoPanel(fleetCombatInfoPanelRect, PlayerFleet, GameManager.instance);

        shipHullList.CheckFirstHull(ChangeHull);
    }
    public MainCustomBattleScreen()
    {
        quitResumeSubScreen = new QuitResumeSubScreen(this, CloseScreen);

        ShipSelectionRect = new Rect(0, 0, Screen.width * 0.25f, Screen.height * 0.65f);

        ShipsCategoryButtonRect    = new Rect(ShipSelectionRect.x + ShipSelectionRect.width * 0.02f, ShipSelectionRect.y, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        StationCategoryButtonRect  = new Rect(ShipSelectionRect.x + (ShipSelectionRect.width - GameManager.instance.StandardButtonSize.x) / 2f, ShipSelectionRect.y, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        FightersCategoryButtonRect = new Rect(ShipSelectionRect.xMax - (GameManager.instance.StandardButtonSize.x + ShipSelectionRect.width * 0.02f), ShipSelectionRect.y, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);

        Rect UnitListRect = new Rect(ShipSelectionRect.width * 0.05f, ShipsCategoryButtonRect.yMax + ShipSelectionRect.height * 0.01f, ShipSelectionRect.width * .9f, ShipSelectionRect.height * 0.25f);

        shipHullList    = new ShipHullScrollList(UnitListRect, ChangeHull, CheckHullValid);
        stationHullList = new StationHullScrollList(UnitListRect, ChangeStationHull, CheckStationHullValid);
        fighterList     = new FighterScrollList(new Rect(UnitListRect.x, UnitListRect.y, UnitListRect.width, UnitListRect.height * 2f), ChangeFighter, CheckFighterValid);

        DesignScrollWindowRect = new Rect(shipHullList.getRect().x, shipHullList.getRect().yMax + Screen.height * 0.025f, shipHullList.getRect().width, shipHullList.getRect().height);
        DesignScrollViewRect   = new Rect(0, 0, DesignScrollWindowRect.width * 0.92f, DesignScrollWindowRect.height + 1);
        DesignScrollPostion    = Vector2.zero;

        OwnerPlayerButtonRect  = new Rect(ShipSelectionRect.width / 2 - GameManager.instance.StandardButtonSize.x / 2, DesignScrollWindowRect.yMax + GameManager.instance.StandardButtonSize.y, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        OwnerEnemyButtonRect   = new Rect(OwnerPlayerButtonRect.x, OwnerPlayerButtonRect.yMax, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        OwnerAlliedButtonRect  = new Rect(OwnerPlayerButtonRect.x, OwnerEnemyButtonRect.yMax, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        OwnerNeutralButtonRect = new Rect(OwnerPlayerButtonRect.x, OwnerAlliedButtonRect.yMax, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);

        float indent = (ShipSelectionRect.width - GameManager.instance.StandardButtonSize.x * 2f) / 3f;

        StartButtonRect   = new Rect(indent, ShipSelectionRect.yMax - GameManager.instance.StandardButtonSize.y * 2, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);
        SummaryButtonRect = new Rect(StartButtonRect.xMax + indent, StartButtonRect.y, GameManager.instance.StandardButtonSize.x, GameManager.instance.StandardButtonSize.y);

        PlayerFleet  = new FleetData();
        EnemyFleet   = new FleetData();
        AlliedFleet  = new FleetData();
        NeutralFleet = new FleetData();

        PlayerShipManager  = new ShipManager(true, PlayerFleet, 9);
        EnemyShipManager   = new ShipManager(false, EnemyFleet, 10);
        AlliedShipManager  = new ShipManager(false, AlliedFleet, 11);
        NeutralShipManager = new ShipManager(false, NeutralFleet, 13);

        ShipManagers.Add(PlayerShipManager);
        ShipManagers.Add(EnemyShipManager);
        ShipManagers.Add(AlliedShipManager);
        ShipManagers.Add(NeutralShipManager);

        SetPauseShipManagers(true);

        EnemyShipManager.SetAI(true);
        AlliedShipManager.SetAI(true);

        //Set Combat diplomacy
        PlayerShipManager.AddEnemyShipManager(EnemyShipManager);
        PlayerShipManager.AddAlliedShipManager(AlliedShipManager);
        EnemyShipManager.AddEnemyShipManager(PlayerShipManager);
        EnemyShipManager.AddEnemyShipManager(AlliedShipManager);
        AlliedShipManager.AddEnemyShipManager(EnemyShipManager);
        AlliedShipManager.AddAlliedShipManager(PlayerShipManager);

        shipDragSelectionBox = new ShipDragSelectionBox();

        float toolTipWidth = Screen.width * 0.175f;

        ToolTip = new GUIToolTip(new Vector2(Screen.width - toolTipWidth, 0), toolTipWidth);

        Vector2 shipPanelSize = new Vector2(Screen.width * 0.5f, Screen.height * 0.25f);

        shipInfoPanel = new ShipCombatInfoPanel(this, new Rect(new Vector2((Screen.width - shipPanelSize.x) / 2, Screen.height - shipPanelSize.y), shipPanelSize), PlayerShipManager, ToolTip);

        float MiniMapSize = Screen.height * 0.2f;
        Rect  miniMapRect = new Rect(Screen.width - Screen.height * 0.215f, Screen.height - Screen.height * 0.215f, MiniMapSize, MiniMapSize);

        miniMap = new MiniMap(miniMapRect, GameManager.instance.miniMapTexture, ToolTip);
        float GameSpeedButtonSize = miniMapRect.width / 5f;

        gameSpeedButton = new GameSpeedButton(new Rect(miniMapRect.x - GameSpeedButtonSize, miniMapRect.yMax - GameSpeedButtonSize, GameSpeedButtonSize, GameSpeedButtonSize), ToolTip);

        combatTimer = new CombatTimer(new Rect(Screen.width * 0.475f, 0, Screen.width * 0.05f, Screen.height * 0.03f), ToolTip);

        Rect fleetCombatInfoPanelRect = new Rect(0, Screen.height - shipPanelSize.y, shipPanelSize.y, shipPanelSize.y);

        fleetCombatInfoPanel = new FleetCombatInfoPanel(fleetCombatInfoPanelRect, PlayerFleet, GameManager.instance);

        shipHullList.CheckFirstHull(ChangeHull);

        doubleClickDetector = new DoubleClickDetector(0.25f);
        combatCameraMover   = new CombatCameraMover();
        storedUnitPanel     = new CombatStoredUnitPanel(PlayerShipManager, ToolTip);

        SummaryScrollList = new CombatSummaryScrollList();

        ContructDesignDisplayWindow();
    }