Ejemplo n.º 1
0
 private void Awake()
 {
     if (ChallengesManager.instance == null)
     {
         ChallengesManager.instance = this;
     }
 }
Ejemplo n.º 2
0
    private string GetFilePostfix()
    {
        if (ChallengesManager.Get().m_ActiveChallengeName.Length > 0)
        {
            return(ChallengesManager.Get().m_ActiveChallengeName);
        }
        if (ChallengesManager.Get().m_ChallengeToActivate.Length > 0)
        {
            return(ChallengesManager.Get().m_ChallengeToActivate);
        }
        switch (DifficultySettings.ActivePreset.m_BaseDifficulty)
        {
        case GameDifficulty.Easy:
            return("Easy");

        case GameDifficulty.Normal:
            return("Normal");

        case GameDifficulty.Hard:
            return("Hard");

        default:
            return("Normal");
        }
    }
Ejemplo n.º 3
0
 private void SetupChallengeDescription()
 {
     this.m_DescCanvasGroup.alpha = 0f;
     if (this.m_SelectedChallenge != null)
     {
         this.m_Icon.sprite        = this.m_SelectedChallenge.m_Icon;
         this.m_ChallengeName.text = GreenHellGame.Instance.GetLocalization().Get(this.m_SelectedChallenge.m_NameID, true);
         this.m_Description.text   = GreenHellGame.Instance.GetLocalization().Get(this.m_SelectedChallenge.m_DescriptionID, true);
         this.m_StartTime.text     = ChallengesManager.Get().DateTimeToLocalizedString(this.m_SelectedChallenge.m_StartDate, true);
         this.m_EndTime.text       = ChallengesManager.Get().DateTimeToLocalizedString(this.m_SelectedChallenge.m_EndDate, true);
         if (this.m_SelectedChallenge.m_BestScore > 0f)
         {
             this.m_BestTime.text = GreenHellGame.Instance.GetLocalization().Get("ChallengeResult_BestTime", true);
             Text bestTime = this.m_BestTime;
             bestTime.text += " - ";
             DateTime date      = this.m_SelectedChallenge.m_StartDate.AddHours((double)this.m_SelectedChallenge.m_BestScore);
             Text     bestTime2 = this.m_BestTime;
             bestTime2.text += ChallengesManager.Get().DateTimeToLocalizedString(date, false);
             float fillAmount = this.m_SelectedChallenge.m_BestScore / this.m_SelectedChallenge.m_Duration;
             this.m_BestResultBelt.fillAmount = fillAmount;
             return;
         }
         this.m_BestTime.text             = string.Empty;
         this.m_BestResultBelt.fillAmount = 0f;
     }
 }
Ejemplo n.º 4
0
    private void SetupTimeLimit(Challenge challenge)
    {
        this.m_TimerText.text = GreenHellGame.Instance.GetLocalization().Get("HUDChallenge_TimeLimit");
        Text timerText = this.m_TimerText;

        timerText.text += " ";
        Text timerText2 = this.m_TimerText;

        timerText2.text += ChallengesManager.Get().DateTimeToLocalizedString(challenge.m_EndDate, false);
    }
Ejemplo n.º 5
0
 public void OnChallenge(string name)
 {
     ChallengesManager.Get().m_ChallengeToActivate = name;
     ScenarioManager.Get().m_SkipTutorial          = true;
     MainLevel.Instance.m_GameMode     = GameMode.Survival;
     GreenHellGame.Instance.m_GameMode = GameMode.Survival;
     MainLevel.Instance.Initialize();
     MenuInGameManager.Get().HideMenu();
     this.StartRainforestAmbienceMultisample();
 }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 7
0
 public void StartGame()
 {
     this.LoadScenesAsync("Level", LoadSceneMode.Single);
     if (ChallengesManager.Get().m_ChallengeToActivate.Length == 0)
     {
         if (GreenHellGame.Instance.m_GameMode == GameMode.Story)
         {
             this.LoadScenesAsync("Story", LoadSceneMode.Additive);
         }
         this.LoadScenesAsync("LootBoxes", LoadSceneMode.Additive);
     }
     this.m_LoadState = GreenHellGame.LoadState.GameLoading;
 }
Ejemplo n.º 8
0
 private void OnFinish(bool success)
 {
     if (this.m_Objectives.Count > this.m_ObjectiveIndex)
     {
         ObjectivesManager.Get().DeactivateObjective(this.m_Objectives[this.m_ObjectiveIndex]);
     }
     HUDChallengeTimer.Get().Deactivate();
     HUDChallengeInfo.Get().Deactivate();
     HUDChallengeResult.Get().Activate(success, this);
     Player.Get().BlockMoves();
     Player.Get().BlockRotation();
     ChallengesManager.Get().OnFinishChallenge(success);
 }
Ejemplo n.º 9
0
    protected override bool ShouldShow()
    {
        if (GreenHellGame.Instance.m_GameMode != GameMode.Story)
        {
            return(false);
        }
        if (ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding"))
        {
            return(false);
        }
        if (ChallengesManager.Get() && ChallengesManager.Get().IsChallengeActive())
        {
            return(false);
        }
        if (ConsciousnessController.Get().IsActive())
        {
            return(false);
        }
        if (SleepController.Get().IsActive())
        {
            return(false);
        }
        if (HUDReadableItem.Get().enabled)
        {
            return(false);
        }
        if (Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash))
        {
            return(false);
        }
        if (Time.time - SwimController.Get().m_LastDisableTime < 0.5f)
        {
            return(false);
        }
        if (Player.Get().m_IsInAir)
        {
            return(false);
        }
        if (HUDWheel.Get().enabled)
        {
            return(false);
        }
        if (FPPController.Get().m_Dodge)
        {
            return(false);
        }
        int shortNameHash = Player.Get().m_Animator.GetCurrentAnimatorStateInfo(1).shortNameHash;

        return(shortNameHash != this.m_MapWatchHideHash && shortNameHash != this.m_MapWatchIdleHash && shortNameHash != this.m_MapWatchShowHash && shortNameHash != this.m_MapZoomHash && shortNameHash != this.m_MapHideHash && shortNameHash != this.m_MapIdleHash && shortNameHash != this.m_ShowMapHash && (!DeathController.Get().IsActive() && !InsectsController.Get().IsActive() && !ScenarioManager.Get().IsDreamOrPreDream() && !Inventory3DManager.Get().IsActive() && !CutscenesManager.Get().IsCutscenePlaying() && !SwimController.Get().IsActive() && !BodyInspectionController.Get().IsActive() && !HarvestingAnimalController.Get().IsActive() && !HarvestingSmallAnimalController.Get().IsActive() && !VomitingController.Get().IsActive() && !MapController.Get().IsActive() && !NotepadController.Get().IsActive() && !MudMixerController.Get().IsActive()) && !MakeFireController.Get().IsActive());
    }
Ejemplo n.º 10
0
    private void SetupCurrentResult(Challenge challenge)
    {
        this.m_CurrentTimeText.text = GreenHellGame.Instance.GetLocalization().Get("ChallengeResult_CurrTime", true);
        Text currentTimeText = this.m_CurrentTimeText;

        currentTimeText.text += " - ";
        DateTime date             = challenge.m_StartDate.AddHours((double)challenge.m_CurrentScore);
        Text     currentTimeText2 = this.m_CurrentTimeText;

        currentTimeText2.text += ChallengesManager.Get().DateTimeToLocalizedString(date, false);
        float fillAmount = challenge.m_CurrentScore / challenge.m_Duration;

        this.m_CurrentResultBelt.fillAmount = fillAmount;
    }
Ejemplo n.º 11
0
 public override void OnShow()
 {
     base.OnShow();
     DebugUtils.Assert(this.m_Buttons.Count >= ChallengesManager.Get().m_Challenges.Count, "Not enough buttons!", true, DebugUtils.AssertType.Info);
     for (int i = 0; i < ChallengesManager.Get().m_Challenges.Count; i++)
     {
         Text componentInChildren = this.m_Buttons[i].GetComponentInChildren <Text>();
         componentInChildren.text = GreenHellGame.Instance.GetLocalization().Get(ChallengesManager.Get().m_Challenges[i].m_NameID, true);
         this.m_Color             = componentInChildren.color;
     }
     for (int j = ChallengesManager.Get().m_Challenges.Count; j < this.m_Buttons.Count; j++)
     {
         this.m_Buttons[j].gameObject.SetActive(false);
     }
     this.m_Loading = false;
 }
Ejemplo n.º 12
0
 private void SetupBestResult(Challenge challenge)
 {
     if (challenge.m_BestScore > 0f)
     {
         this.m_BestTimeText.text = GreenHellGame.Instance.GetLocalization().Get("ChallengeResult_BestTime", true);
         Text bestTimeText = this.m_BestTimeText;
         bestTimeText.text += " - ";
         DateTime date          = challenge.m_StartDate.AddHours((double)challenge.m_BestScore);
         Text     bestTimeText2 = this.m_BestTimeText;
         bestTimeText2.text += ChallengesManager.Get().DateTimeToLocalizedString(date, false);
         float fillAmount = challenge.m_BestScore / challenge.m_Duration;
         this.m_BestResultBelt.fillAmount = fillAmount;
         return;
     }
     this.m_BestTimeText.text         = string.Empty;
     this.m_BestResultBelt.fillAmount = 0f;
 }
Ejemplo n.º 13
0
 private void UpdateButtons()
 {
     this.m_SelectedChallenge = null;
     for (int i = 0; i < this.m_Buttons.Count; i++)
     {
         Button button = this.m_Buttons[i];
         if (!button.gameObject.activeSelf)
         {
             break;
         }
         UnityEngine.Object      gameObject       = button.gameObject;
         MenuBase.MenuOptionData activeMenuOption = this.m_ActiveMenuOption;
         if (gameObject == ((activeMenuOption != null) ? activeMenuOption.m_Object : null))
         {
             this.m_SelectedChallenge = ChallengesManager.Get().m_Challenges[i];
             this.SetActiveButton(button);
         }
     }
 }
Ejemplo n.º 14
0
 public override void OnAnimEvent(AnimEventID id)
 {
     if (id == AnimEventID.DeathEnd)
     {
         this.SetState(DeathController.DeathState.Death);
         if (ChallengesManager.Get().IsChallengeActive())
         {
             ChallengesManager.Get().FailChallenge();
         }
     }
     else if (id == AnimEventID.DeathFall)
     {
         PlayerAudioModule.Get().PlayBodyFallSound();
     }
     else
     {
         base.OnAnimEvent(id);
     }
 }
Ejemplo n.º 15
0
 private string GetScriptName()
 {
     if (GreenHellGame.TWITCH_DEMO)
     {
         return(Scenario.s_TwitchDemoScript);
     }
     if (ChallengesManager.Get() && ChallengesManager.Get().IsChallengeActive())
     {
         return(Scenario.s_ChallengeScript);
     }
     if (MainLevel.Instance.m_GameMode == GameMode.Story)
     {
         return(Scenario.s_StoryScript);
     }
     if (MainLevel.Instance.m_GameMode == GameMode.Survival)
     {
         return(Scenario.s_SurvivalScript);
     }
     return(Scenario.s_StoryScript);
 }
Ejemplo n.º 16
0
 private void SetupStartEndTimes(Challenge challenge)
 {
     this.m_StartTimeText.text = ChallengesManager.Get().DateTimeToLocalizedString(challenge.m_StartDate, true);
     this.m_EndTimeText.text   = ChallengesManager.Get().DateTimeToLocalizedString(challenge.m_EndDate, true);
 }
Ejemplo n.º 17
0
 private void UpdateElements()
 {
     if (this.m_State == HUDObjectiveState.Normal)
     {
         float num  = 0f;
         float num2 = 0f;
         float num3 = 0f;
         if (this.m_ObjectivesElements.Count > 0)
         {
             num3 = this.m_ObjectivesElements[0].m_HudElem.transform.localPosition.y;
         }
         for (int i = 0; i < this.m_ObjectivesElements.Count; i++)
         {
             HUDObjective hudobjective = this.m_ObjectivesElements[i];
             this.SetupTargetPosition(hudobjective);
             Vector3 zero = Vector3.zero;
             zero.Set(hudobjective.m_HudElem.transform.localPosition.x, num3 - num, hudobjective.m_HudElem.transform.localPosition.z);
             hudobjective.m_HudElem.transform.localPosition = zero;
             Vector3 position = hudobjective.m_BG.transform.position;
             position.x += (hudobjective.m_BGTargetPosition.x - hudobjective.m_BG.transform.position.x) * Time.deltaTime * 6f;
             hudobjective.m_BG.transform.position = position;
             position    = hudobjective.m_TextComponent.transform.position;
             position.x += (hudobjective.m_TextTargetPosition.x - hudobjective.m_TextComponent.transform.position.x) * Time.deltaTime * 6f;
             hudobjective.m_TextComponent.transform.position = position;
             Vector3 localPosition = hudobjective.m_TextComponent.transform.localPosition;
             num += hudobjective.m_BG.rectTransform.sizeDelta.y + num2;
             float num4  = (this.m_ObjectiveDuration == 0f) ? 1f : Mathf.Clamp01((this.m_ObjectiveDuration - (Time.time - hudobjective.m_StartTime)) / 0.5f);
             Color color = hudobjective.m_TextComponent.color;
             color.a = (ChallengesManager.Get().IsChallengeActive() ? 1f : num4);
             hudobjective.m_TextComponent.color = color;
             color   = hudobjective.m_BG.color;
             color.a = (ChallengesManager.Get().IsChallengeActive() ? 1f : num4);
             hudobjective.m_BG.color = color;
             Vector3 localScale = ((RectTransform)HUDManager.Get().m_CanvasGameObject.transform).localScale;
             color   = Color.white;
             color.a = Mathf.Abs(Mathf.Sin((Time.time - hudobjective.m_StartTime) * 5f));
             if (Time.time - hudobjective.m_StartTime > 5f)
             {
                 color.a = 1f;
             }
             hudobjective.m_Icon.color = color;
         }
         int j = 0;
         while (j < this.m_ObjectivesElements.Count)
         {
             HUDObjective hudobjective2 = this.m_ObjectivesElements[j];
             bool         flag          = (this.m_ObjectiveDuration > 0f) ? (Time.time > hudobjective2.m_StartTime + this.m_ObjectiveDuration) : (hudobjective2.m_Objective.GetState() == ObjectiveState.Completed);
             if (GreenHellGame.ROADSHOW_DEMO)
             {
                 flag = (hudobjective2.m_Objective.GetState() == ObjectiveState.Completed);
             }
             else if (ChallengesManager.Get().IsChallengeActive())
             {
                 flag = false;
             }
             if (flag)
             {
                 base.RemoveElement(hudobjective2.m_HudElem);
                 this.m_ObjectivesElements.RemoveAt(j);
             }
             else
             {
                 j++;
             }
         }
         for (int k = 0; k < this.m_ObjectivesElements.Count; k++)
         {
             this.m_ObjectivesElements[k].m_HudElem.SetActive(true);
         }
         if (this.m_MapHUDObjective != null)
         {
             this.m_MapHUDObjective.m_HudElem.SetActive(false);
             return;
         }
     }
     else if (this.m_State == HUDObjectiveState.Map)
     {
         if (this.m_MapObjective != null)
         {
             if (this.m_MapHUDObjective != null)
             {
                 this.m_MapHUDObjective.m_HudElem.SetActive(true);
                 HUDObjective mapHUDObjective = this.m_MapHUDObjective;
                 Vector3      position2       = mapHUDObjective.m_BG.transform.position;
                 position2.x += (mapHUDObjective.m_BGTargetPosition.x - mapHUDObjective.m_BG.transform.position.x) * Time.deltaTime * 6f;
                 mapHUDObjective.m_BG.transform.position = position2;
                 position2    = mapHUDObjective.m_TextComponent.transform.position;
                 position2.x += (mapHUDObjective.m_TextTargetPosition.x - mapHUDObjective.m_TextComponent.transform.position.x) * Time.deltaTime * 6f;
                 mapHUDObjective.m_TextComponent.transform.position = position2;
             }
         }
         else if (this.m_MapHUDObjective != null)
         {
             this.m_MapHUDObjective.m_HudElem.SetActive(false);
         }
         for (int l = 0; l < this.m_ObjectivesElements.Count; l++)
         {
             this.m_ObjectivesElements[l].m_HudElem.SetActive(false);
         }
     }
 }
Ejemplo n.º 18
0
        public async Task Execute(IJobExecutionContext context)
        {
            Log.Information("Starting Challenge Release Job");

            SchedulerContext     schedulerContext = context.Scheduler.Context;
            DiscordSocketClient  client           = (DiscordSocketClient)schedulerContext.Get("client");
            IServiceScopeFactory scopeFactory     = (IServiceScopeFactory)schedulerContext.Get("scopeFactory");

            using var scope = scopeFactory.CreateScope();
            var dbContext = scope.ServiceProvider.GetService <DatabaseContext>();

            var config = dbContext.Configuration.FirstOrDefault();

            if (config == null || config.ChallengeReleaseChannelId == 0)
            {
                Log.Information("Aborting Challenge Release Job because some configuration values are not defined");
                return;
            }

            var channel = client.GetGuild(config.GuildId).GetTextChannel(config.ChallengeReleaseChannelId);

            var lastChall = await dbContext.Challenges.AsAsyncEnumerable().Where(x => x.State == 2).OrderByDescending(x => x.ReleaseDate).FirstOrDefaultAsync();

            var chall = ChallengesManager.GetChallengeToBeReleased(dbContext, release: true).GetAwaiter().GetResult();

            if (chall == null)
            {
                Log.Information("Aborting Challenge Release Job because no challenge is ready to be released");
                return;
            }

            if (config.TodaysChannelId != 0 && config.TodaysRoleId != 0)
            {
                Log.Information("Deleting and re-creating Today's Channel role");
                var oldRole = client.GetGuild(config.GuildId).GetRole(config.TodaysRoleId);
                var newRole = await client.GetGuild(config.GuildId).CreateRoleAsync(oldRole.Name, oldRole.Permissions, oldRole.Color, oldRole.IsHoisted, oldRole.IsMentionable);

                await client.GetGuild(config.GuildId).GetTextChannel(config.TodaysChannelId).AddPermissionOverwriteAsync(newRole, new OverwritePermissions(viewChannel: PermValue.Allow));

                await oldRole.DeleteAsync();

                config.TodaysRoleId = newRole.Id;
                await dbContext.SaveChangesAsync();

                Log.Information("Purging Today's Channel");
                var todaysChannel = client.GetGuild(config.GuildId).GetTextChannel(config.TodaysChannelId);
                var messages      = await todaysChannel.GetMessagesAsync(int.MaxValue).FlattenAsync();

                messages = messages.Where(x => (DateTimeOffset.UtcNow - x.Timestamp).TotalDays <= 14);
                if (messages.Any())
                {
                    await todaysChannel.DeleteMessagesAsync(messages);
                }

                Log.Information("Posting the challenge writeup on today's channel");
                if (!string.IsNullOrEmpty(chall.Writeup))
                {
                    var writeupEmbed = new CustomEmbedBuilder();
                    writeupEmbed.WithTitle("Intended Solution");
                    writeupEmbed.WithDescription(chall.Writeup);
                    var message = await todaysChannel.SendMessageAsync(embed : writeupEmbed.Build());

                    await message.PinAsync();
                }
            }

            if (!string.IsNullOrEmpty(chall.Writeup) && config.BoardWriteupsChannelId != 0)
            {
                Log.Information("Posting the challenge writeup on the board writeups channel");
                var writeupEmbed = new CustomEmbedBuilder();
                writeupEmbed.WithTitle($"Writeup for {chall.Title}");
                writeupEmbed.WithDescription($"{chall.Writeup}\n**Flag:** {chall.Flag}");
                var writeupsChannel = client.GetGuild(config.GuildId).GetTextChannel(config.BoardWriteupsChannelId);
                await writeupsChannel.SendMessageAsync(embed : writeupEmbed.Build());
            }

            Log.Information("Posting the challenge on Discord");
            var             embed = ChallengesManager.GetChallengeEmbed(chall);
            RestUserMessage challengeMessage;

            if (config.ChallengePingRoleId != 0)
            {
                challengeMessage = await channel.SendMessageAsync($"<@&{config.ChallengePingRoleId}>", embed : embed);
            }
            else
            {
                challengeMessage = await channel.SendMessageAsync(embed : embed);
            }
            if (channel is INewsChannel)
            {
                await challengeMessage.CrosspostAsync();
            }

            Log.Information("Ending Challenge Release Job");
        }
Ejemplo n.º 19
0
 protected override bool ShouldShow()
 {
     return(DeathController.Get().IsState(DeathController.DeathState.Death) && !ChallengesManager.Get().IsChallengeActive());
 }
Ejemplo n.º 20
0
 public void OnButton(int index)
 {
     ChallengesManager.Get().m_ChallengeToActivate = ChallengesManager.Get().m_Challenges[index].m_Name;
     base.Invoke("OnPreStartGame", 0.3f);
     this.m_Loading = true;
 }
Ejemplo n.º 21
0
 public override bool CanTrigger()
 {
     return((!this.m_CantTriggerDuringDialog || !DialogsManager.Get().IsAnyDialogPlaying()) && !MainLevel.Instance.m_SaveGameBlocked && !GreenHellGame.Instance.IsGamescom() && ReplTools.AmIMaster() && !ChallengesManager.Get().IsChallengeActive());
 }
Ejemplo n.º 22
0
 public void OnResetChallenges()
 {
     ChallengesManager.Get().ResetChallenges();
 }
Ejemplo n.º 23
0
 public override bool CanTrigger()
 {
     return(!ChallengesManager.Get().IsChallengeActive());
 }
Ejemplo n.º 24
0
    private void ParseScript()
    {
        ScriptParser scriptParser = new ScriptParser();
        string       text         = "Balance/Balance_";

        text += this.GetFilePostfix();
        text += ".txt";
        int num = 0;

        scriptParser.Parse(text, true);
        if (scriptParser.GetKeysCount() == 0 && (ChallengesManager.Get().m_ActiveChallengeName.Length > 0 || ChallengesManager.Get().m_ChallengeToActivate.Length > 0))
        {
            text  = "Balance/Balance_";
            text += "Hard";
            text += ".txt";
            scriptParser.Parse(text, true);
        }
        for (int i = 0; i < scriptParser.GetKeysCount(); i++)
        {
            Key key = scriptParser.GetKey(i);
            if (key.GetName() == "Prefab")
            {
                BSItemData bsitemData = new BSItemData();
                bsitemData.m_PrefabName = key.GetVariable(0).SValue;
                bsitemData.m_Prefab     = GreenHellGame.Instance.GetPrefab(bsitemData.m_PrefabName);
                DebugUtils.Assert(bsitemData.m_Prefab.GetComponent <Item>() != null, true);
                string[] array = key.GetVariable(2).SValue.Split(new char[]
                {
                    ';'
                });
                foreach (string text2 in array)
                {
                    if (!this.m_Groups.ContainsKey(text2))
                    {
                        this.m_Groups.Add(text2, new BalanceSystem20.GroupProps(text2, 3, num++));
                    }
                    if (key.GetVariable(1).SValue == "Spawn")
                    {
                        if (!this.m_SpawnData.ContainsKey(text2))
                        {
                            this.m_SpawnData.Add(text2, new List <BSItemData>());
                        }
                        this.m_SpawnData[text2].Add(bsitemData);
                    }
                    else if (key.GetVariable(1).SValue == "Attachment")
                    {
                        if (!this.m_AttachmentData.ContainsKey(text2))
                        {
                            this.m_AttachmentData.Add(text2, new List <BSItemData>());
                        }
                        this.m_AttachmentData[text2].Add(bsitemData);
                    }
                }
                for (int k = 0; k < key.GetKeysCount(); k++)
                {
                    Key key2 = key.GetKey(k);
                    if (key2.GetName() == "ItemID")
                    {
                        bsitemData.m_ItemID = (ItemID)Enum.Parse(typeof(ItemID), key2.GetVariable(0).SValue);
                    }
                    else if (key2.GetName() == "BaseChance")
                    {
                        bsitemData.m_BaseChance = key2.GetVariable(0).FValue;
                    }
                    else if (key2.GetName() == "IncRate")
                    {
                        bsitemData.m_IncRate = key2.GetVariable(0).FValue;
                    }
                    else if (key2.GetName() == "Func")
                    {
                        bsitemData.m_Func = null;
                    }
                    else if (key2.GetName() == "WalkRange")
                    {
                        bsitemData.m_WalkRange = key2.GetVariable(0).FValue;
                    }
                    else if (key2.GetName() == "WalkRangeValue")
                    {
                        bsitemData.m_WalkRangeValue = key2.GetVariable(0).FValue;
                    }
                    else if (key2.GetName() == "HaveItem")
                    {
                        array = key2.GetVariable(0).SValue.Split(new char[]
                        {
                            ';'
                        });
                        for (int l = 0; l < array.Length; l++)
                        {
                            bsitemData.m_HaveItemID.Add((int)Enum.Parse(typeof(ItemID), array[l]));
                        }
                    }
                    else if (key2.GetName() == "HaveItemCount")
                    {
                        bsitemData.m_HaveItemCount = key2.GetVariable(0).IValue;
                    }
                    else if (key2.GetName() == "HaveItemNegativeEffect")
                    {
                        bsitemData.m_HaveItemNegativeEffect = key2.GetVariable(0).FValue;
                    }
                }
                bsitemData.m_ChanceAccu = bsitemData.m_BaseChance;
                if (bsitemData.m_ItemID == ItemID.None)
                {
                    EnumUtils <ItemID> .TryGetValue(bsitemData.m_PrefabName, out bsitemData.m_ItemID);
                }
            }
        }
    }
Ejemplo n.º 25
0
 public override bool IsMenuButtonEnabled(Button b)
 {
     return((!(b == this.m_LoadButton) || !ChallengesManager.Get() || !ChallengesManager.Get().m_ChallengeMode) && (!(b == this.m_LoadButton) || !GreenHellGame.Instance.IsGamescom()) && (!(b == this.m_OptionsButton) || !GreenHellGame.TWITCH_DEMO) && !GreenHellGame.GetYesNoDialog().isActiveAndEnabled&& (!(b == this.m_SkipTutorialButton) || (MainLevel.Instance.m_Tutorial && !GreenHellGame.Instance.IsGamescom())) && (!(b == this.m_LoadButton) || ReplTools.IsPlayingAlone()) && !(b == this.m_OnlineButton) && !(b.GetComponent <LobbyMemberListElement>() != null) && base.IsMenuButtonEnabled(b));
 }
 protected override bool ShouldShow()
 {
     return(GreenHellGame.Instance.m_GameMode == GameMode.Story && (!ChallengesManager.Get() || !ChallengesManager.Get().IsChallengeActive()) && !HUDReadableItem.Get().isActiveAndEnabled&& !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding") && (!ScenarioManager.Get().IsDreamOrPreDream() && !Inventory3DManager.Get().IsActive()) && !CutscenesManager.Get().IsCutscenePlaying());
 }
Ejemplo n.º 27
0
 public void Initialize()
 {
     this.m_AllObjects.Clear();
     UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject));
     foreach (GameObject gameObject in array)
     {
         if (gameObject.scene.IsValid())
         {
             this.m_AllObjects.Add(gameObject);
             if (!this.m_UniqueObjects.ContainsKey(gameObject.name))
             {
                 this.m_UniqueObjects.Add(gameObject.name, gameObject);
             }
         }
     }
     if (this.m_AnimalSoundsAudioSource == null)
     {
         this.m_AnimalSoundsAudioSource = base.gameObject.AddComponent <AudioSource>();
         this.m_AnimalSoundsAudioSource.outputAudioMixerGroup = GreenHellGame.Instance.GetAudioMixerGroup(AudioMixerGroupGame.Enviro);
         this.m_AnimalSounds.Clear();
         List <AudioClip> value  = new List <AudioClip>();
         List <AudioClip> value2 = new List <AudioClip>();
         this.m_AnimalSounds.Add(true, value2);
         this.m_AnimalSounds.Add(false, value);
         for (int j = 1; j < 24; j++)
         {
             string text = MainLevel.s_AnimalSoundsDayName;
             if (j < 10)
             {
                 text += "0";
             }
             text += j.ToString();
             AudioClip item = Resources.Load(MSSample.s_SamplesPath + text) as AudioClip;
             this.m_AnimalSounds[true].Add(item);
         }
         for (int k = 1; k < 22; k++)
         {
             string text2 = MainLevel.s_AnimalSoundsNightName;
             if (k < 10)
             {
                 text2 += "0";
             }
             text2 += k.ToString();
             AudioClip item2 = Resources.Load(MSSample.s_SamplesPath + text2) as AudioClip;
             this.m_AnimalSounds[false].Add(item2);
         }
     }
     this.TeleportPlayerOnStart();
     HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.Game);
     ChallengesManager.Get().OnLevelLoaded();
     ScenarioManager.Get().Initialize();
     if (GreenHellGame.Instance.m_FromSave)
     {
         SaveGame.Load();
     }
     if (GreenHellGame.ROADSHOW_DEMO)
     {
         Cheats.m_GodMode = true;
     }
     this.m_FogStartDistance      = RenderSettings.fogStartDistance;
     this.m_FogEndDistance        = RenderSettings.fogEndDistance;
     this.m_EmmisiveColorProperty = Shader.PropertyToID("_EmissionColor");
     this.m_EmissiveColor         = new Color(0.29f, 0.611f, 0.219f, 1f);
     if (GreenHellGame.TWITCH_DEMO)
     {
         new TwitchDemoManager();
     }
     this.m_PostProcessLayer          = Camera.main.GetComponent <PostProcessLayer>();
     this.m_DefaultStationaryBlending = this.m_PostProcessLayer.temporalAntialiasing.stationaryBlending;
     CursorManager.Get().ResetCursorRequests();
     CursorManager.Get().ShowCursor(false);
     CursorManager.Get().SetCursor(CursorManager.TYPE.Normal);
     this.m_NGSSDirectional = this.m_TODSky.gameObject.GetComponentInChildren <NGSS_Directional>();
     this.m_GrassManager    = Terrain.activeTerrain.GetComponent <GrassManager>();
 }
Ejemplo n.º 28
0
    private void UpdateButtons()
    {
        Color color = this.m_Color;

        color.a = MainMenuScreen.s_ButtonsAlpha;
        Vector2 screenPoint  = Input.mousePosition;
        Button  activeButton = null;

        this.m_SelectedChallenge = null;
        RectTransform component;

        for (int i = 0; i < this.m_Buttons.Count; i++)
        {
            Button button = this.m_Buttons[i];
            if (!button.gameObject.activeSelf)
            {
                break;
            }
            button.GetComponentInChildren <Text>().color = this.m_Color;
            component = button.GetComponent <RectTransform>();
            if (RectTransformUtility.RectangleContainsScreenPoint(component, screenPoint))
            {
                activeButton             = button;
                this.m_SelectedChallenge = ChallengesManager.Get().m_Challenges[i];
            }
        }
        this.m_BackButton.GetComponentInChildren <Text>().color = this.m_Color;
        component = this.m_BackButton.GetComponent <RectTransform>();
        if (RectTransformUtility.RectangleContainsScreenPoint(component, screenPoint))
        {
            activeButton = this.m_BackButton;
        }
        this.SetActiveButton(activeButton);
        foreach (Button button2 in this.m_Buttons)
        {
            if (!button2.gameObject.activeSelf)
            {
                break;
            }
            component = button2.GetComponentInChildren <Text>().GetComponent <RectTransform>();
            Vector3 position = component.position;
            float   num      = (!(this.m_ActiveButton == button2)) ? MainMenu.s_ButtonTextStartX : MainMenu.s_SelectedButtonX;
            float   num2     = Mathf.Ceil(num - position.x) * Time.deltaTime * 10f;
            num                = ((!(this.m_ActiveButton == button2)) ? MainMenu.s_ButtonTextStartX : MainMenu.s_SelectedButtonX);
            num2               = Mathf.Ceil(num - position.x) * Time.deltaTime * 10f;
            position.x        += num2;
            component.position = position;
            if (this.m_ActiveButton == button2)
            {
                color   = button2.GetComponentInChildren <Text>().color;
                color.a = 1f;
                button2.GetComponentInChildren <Text>().color = color;
            }
        }
        if (this.m_ActiveButton == this.m_BackButton)
        {
            color   = this.m_BackButton.GetComponentInChildren <Text>().color;
            color.a = 1f;
            this.m_BackButton.GetComponentInChildren <Text>().color = color;
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            this.OnBack();
        }
        this.UpdateDescription();
    }