Пример #1
0
    /**
     * Parse file and render buildings when scene starts
     */
    private void Start()
    {
        Caching.ClearCache();
        //hide and lock cursor into center
        UiUtils.HideCursor();

        TutorialUtils.InitTutorial(TutorialCanvas, Settings);
        BuildingPickerCanvas.SetActive(false);
        ExitCanvasDialog.SetActive(false);

        //load XML file tags
        var xmlFile = new XmlDocument();

        //load file
        xmlFile.Load(FileUtils.GetFullMapPath(Map.MapName));
        //get node and way tags
        var nodeTags = xmlFile.SelectNodes(".//node");
        var wayTags  = xmlFile.SelectNodes(".//way");
        //cache IDs in node tag for coordinate pairing
        var nodeTagIds = CacheNodeTagIds(nodeTags);

        //parse building and roads
        var buildings      = BuildingLoader.Get().LoadFile(nodeTags, nodeTagIds, wayTags);
        var roads          = RoadLoader.Get().LoadFile(nodeTags, nodeTagIds, wayTags);
        var trees          = TreeLoader.Get().LoadFile();
        var mapMiddlePoint = GetMiddlePoint(buildings, roads);

        //download elevation data
        AltitudeLoader.Get().SetAltitude(TerrainUtils.GetLatLngGrid(mapMiddlePoint));
        //render terrain, buildings, roads etc.
        StartCoroutine(RenderObjects(mapMiddlePoint, buildings, roads, trees));
    }
Пример #2
0
    void Update()
    {
        #if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.F8))
        {
            Companies.AddResources(MyCompany, 1000000000, "CHEATS");
            Refresh();
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            //foreach (var e in (TutorialFunctionality[])System.Enum.GetValues(typeof(TutorialFunctionality)))
            TutorialUtils.Unlock(Q, TutorialFunctionality.UnlockAll);
        }


        if (Input.GetKeyDown(KeyCode.F6))
        {
            Companies.CreateProductAndAttachItToGroup(Q, NicheType.Com_Blogs, MyCompany);
            Refresh();
        }
        #endif

        //if (Input.GetKeyDown(KeyCode.F9))
        //{
        //    Companies.CreateProductAndAttachItToGroup(Q, NicheType.ECom_BookingTours, MyCompany);
        //    Companies.CreateProductAndAttachItToGroup(Q, NicheType.ECom_BookingHotels, MyCompany);
        //    Companies.CreateProductAndAttachItToGroup(Q, NicheType.ECom_PaymentSystem, MyCompany);
        //}
    }
Пример #3
0
 /**
  * Set controls
  */
 private void Update()
 {
     TutorialUtils.ShowTutorial(TutorialCanvas, Settings);
     EnvironmentRender.Get().SetSkyBox();
     BuildingPlacer.PlaceNewBuildingListener();
     MenuController.Get().SetCanvasListener(TutorialCanvas, BuildingPickerCanvas, BuildingNameLabel, ExitCanvasDialog);
     Movement.SetKeyboard(CameraTransform);
     Movement.SetMouse(CameraTransform);
     Movement.SetGamePad(CameraTransform);
 }
Пример #4
0
    public override void ViewRender()
    {
        base.ViewRender();

        var show = TutorialUtils.IsOpenedFunctionality(Q, TutorialFunctionality);

        foreach (var obj in HideableObjects)
        {
            obj.SetActive(show);
        }
    }
Пример #5
0
        /**
         * Set click listener for alt/Y key
         */
        private void SetAltKeyListener(GameObject tutorialCanvas, GameObject exitCanvasDialog)
        {
            if (!ControlUtils.HelpAction())
            {
                return;
            }

            if (exitCanvasDialog.activeSelf)
            {
                Main.Settings.Tutorial = false;
                TutorialUtils.ShowTutorial(tutorialCanvas, Main.Settings);
                exitCanvasDialog.SetActive(false);
            }
        }
Пример #6
0
    public override void ViewRender()
    {
        base.ViewRender();

        var links = GetComponent <ProductUpgradeLinks>();

        if (links == null)
        {
            return;
        }

        // checkbox text
        links.Title.text = GetButtonTitle() + "\n" + GetBenefits();


        // proper animation
        links.Toggle.isOn = state;
        var anim = links.ToggleAnim;

        if (!TutorialUtils.IsDebugMode())
        {
            RenderToggleState(state, anim);
        }

        // hint
        var cost = GetCost() * C.PERIOD / 30;
        var text = $"{GetButtonTitle()}\n\n{GetBenefits()}\n\n";

        if (cost != 0)
        {
            text += "Cost: " + Visuals.Colorize(Format.Money(cost), Economy.IsCanMaintain(MyCompany, Q, cost));
        }

        var workers = GetAmountOfWorkers();

        if (workers > 0)
        {
            text += $"\n\nWill need {workers} additional workers";
        }

        links.Hint.SetHint("");
        links.CanvasGroup.alpha = state ? 1f : 0.25f;
    }
Пример #7
0
    public override void ViewRender()
    {
        base.ViewRender();

        bool hasProduct = Companies.IsHasDaughters(MyCompany);

        bool isFirstYear = CurrentIntDate < 360;

        bool showStats    = !isFirstYear;
        bool showMessages = hasProduct;


        var hasCultureCooldown = Cooldowns.HasCorporateCultureUpgradeCooldown(Q, MyCompany);

        bool hasReleasedProducts          = Companies.IsHasReleasedProducts(Q, MyCompany);
        var  playerCanExploreAdvancedTabs = hasReleasedProducts;
        bool bankruptcyLooming            = TutorialUtils.IsOpenedFunctionality(Q, TutorialFunctionality.BankruptcyWarning);

        //var canRaiseInvestments = !isRoundActive ;
        var canRaiseInvestments = playerCanExploreAdvancedTabs || bankruptcyLooming;
        var isOnMainScreen      = CurrentScreen == ScreenMode.HoldingScreen;

        bool showAdditionalIcons = false;

        //
        Draw(Main, true);
        Draw(Stats, showStats && isOnMainScreen);

        // messages
        Draw(Messages, false && showMessages);

        // culture
        CultureIcon.color = Visuals.GetColorFromString(hasCultureCooldown ? Colors.COLOR_NEUTRAL : Colors.COLOR_POSITIVE);
        Draw(Culture, false && hasProduct && hasReleasedProducts && !hasCultureCooldown);


        // investments
        //InvestmentsIcon.color = Visuals.GetColorFromString(canRaiseInvestments ? Colors.COLOR_NEUTRAL : Colors.COLOR_POSITIVE);
        Draw(Investments, showAdditionalIcons && hasProduct && canRaiseInvestments && isOnMainScreen);
        Draw(ExploreMarkets, showAdditionalIcons && playerCanExploreAdvancedTabs && isOnMainScreen);
        Draw(Partnerships, showAdditionalIcons && playerCanExploreAdvancedTabs && isOnMainScreen);
    }
Пример #8
0
    //public TopPanelManager TopPanelManager;


    public override void ViewRender()
    {
        base.ViewRender();


        var hasReleasedProducts = Companies.IsHasReleasedProducts(Q, MyCompany);

        var playerCanExploreAdvancedTabs = hasReleasedProducts;

        var daughters         = Companies.GetDaughterProducts(Q, MyCompany);
        var numberOfDaughters = daughters.Length;

        var operatingMarkets = GetOperatingMarkets(daughters);

        bool bankruptcyLooming = TutorialUtils.IsOpenedFunctionality(Q, TutorialFunctionality.BankruptcyWarning);

        bool godMode = TutorialUtils.IsGodMode(Q);

        bool showGroupTab       = godMode || numberOfDaughters > 1 && operatingMarkets.Count > 1;
        bool showCultureTab     = godMode || numberOfDaughters > 1 || Flagship.team.Managers.Count > 1;
        bool showInvestmentsTab = godMode || playerCanExploreAdvancedTabs || bankruptcyLooming;
        bool showTeamTab        = godMode || playerCanExploreAdvancedTabs;
        bool showExpansionTab   = godMode || playerCanExploreAdvancedTabs;
        bool showCompetitors    = false; // && godMode || playerCanExploreAdvancedTabs;

        Draw(DevTab, true);
        Draw(Messages, false);
        Draw(TeamTab, false && showTeamTab);
        Draw(UpgradesTab, showTeamTab);
        //TeamTab.GetComponentInChildren<TextMeshProUGUI>().text = GetTeamTabLabel();

        Draw(GroupTab, showGroupTab);
        Draw(ExpansionTab, false && showExpansionTab);
        Draw(CompetitorsTab, showCompetitors);

        Draw(CorporateCulture, showCultureTab && false);
        CorporateCulture.GetComponentInChildren <TextMeshProUGUI>().text = GetCorporateCultureLabel();

        Draw(Investments, false && showInvestmentsTab);
        Investments.GetComponentInChildren <TextMeshProUGUI>().text = GetInvestmentRoundLabel();
    }
Пример #9
0
    public void Execute()
    {
        if (DateEntity == null)
        {
            return;
        }

        CheckPressedButtons();

        totalTime -= Time.deltaTime;

        if (totalTime < 0 && isTimerRunning)
        {
            var playerCompany = Companies.GetPlayerCompany(gameContext);

            while (ScheduleUtils.IsLastDayOfPeriod(DateEntity) && Economy.IsWillBecomeBankruptOnNextPeriod(gameContext, playerCompany))
            {
                var profit  = Economy.GetProfit(gameContext, playerCompany, true);
                var profit2 = Economy.GetProfit(gameContext, playerCompany);

                var balance = Economy.BalanceOf(playerCompany);

                Debug.Log($"BANKRUPTCY THREAT for {playerCompany.company.Name}. Cash: {Format.Money(balance)}, Profit: {Format.Money(profit2)}\n\n{profit.ToString()}");

                TutorialUtils.Unlock(gameContext, TutorialFunctionality.CanRaiseInvestments);
                TutorialUtils.Unlock(gameContext, TutorialFunctionality.BankruptcyWarning);

                NotificationUtils.AddPopup(gameContext, new PopupMessageBankruptcyThreat(playerCompany.company.Id));

                ScheduleUtils.PauseGame(gameContext);

                return;
            }

            // ResetTimer();
            totalTime = 1 / (float)currentSpeed;

            ScheduleUtils.IncreaseDate(gameContext, 1);
        }
    }
Пример #10
0
 public override void AttachListeners()
 {
     TutorialUtils.AddEventListener(Q, this);
 }
Пример #11
0
 public override void DetachListeners()
 {
     TutorialUtils.RemoveEventListener(Q, this);
 }
Пример #12
0
 void Unlock(TutorialFunctionality tutorialFunctionality)
 {
     TutorialUtils.Unlock(Q, tutorialFunctionality);
 }
Пример #13
0
 public override void Execute()
 {
     TutorialUtils.Unlock(Q, Text);
 }
Пример #14
0
 public override bool NeedsToBeRemoved()
 {
     return(TutorialUtils.IsOpenedFunctionality(Q, TutorialFunctionality));
 }
Пример #15
0
 public override void OnPointerClick(PointerEventData eventData)
 {
     TutorialUtils.Unlock(Q, TutorialFunctionality);
 }
Пример #16
0
    void RenderInvestmentsButton()
    {
        bool hasReleasedProducts = Companies.IsHasReleasedProducts(Q, MyCompany);

        bool bankruptcyLooming = TutorialUtils.IsOpenedFunctionality(Q, TutorialFunctionality.BankruptcyWarning);
    }