Esempio n. 1
0
        public override void Load()
        {
            #region Shaders
            if (Main.netMode != NetmodeID.Server)
            {
                Ref <Effect> nisRef = new Ref <Effect>(GetEffect("Effects/Items/NewItemSheen"));
                GameShaders.Misc["NewItemSheen"] = new MiscShaderData(nisRef, "NewItemSheen");

                Ref <Effect> tooltipSheenRef = new Ref <Effect>(GetEffect("Effects/Items/ItemTooltipSheen"));
                GameShaders.Misc["ItemTooltipSheen"] = new MiscShaderData(tooltipSheenRef, "ItemTooltipSheen");
            }
            #endregion

            #region Detours/IL

            #endregion

            #region UI
            if (Main.netMode != NetmodeID.Server)
            {
                levelBar = new LevelBar();
                levelBar.Activate();
                levelInterface = new UserInterface();
                levelInterface.SetState(levelBar);
            }
            #endregion
        }
Esempio n. 2
0
    private void Awake()
    {
        type = Spawnable.Type.Unit;

        //find references to components
        animator     = GetComponent <Animator>();
        navMeshAgent = GetComponent <NavMeshAgent>(); //will be disabled until Activate is called
        levelBar     = GetComponentInChildren <LevelBar>();
    }
        private void EnterTheDungeon_Click(object sender, EventArgs e)
        {
            ConnectToDatabase("root", "root");
            DataTable        Table0 = new DataTable();
            MySqlDataAdapter Adapter0;

            Table0   = new DataTable();
            Adapter0 = new MySqlDataAdapter("select * from `kursach_database`.`Character` where id_Character = '" + NameOfCharacter + "';", Connection);
            Adapter0.Fill(Table0);
            DisconnectFromDatabase();
            bool GotCoolestWeapon = false;

            if (Table0.Rows[0][8].ToString() == "100")
            {
                if (GotCoolestWeapon == false)
                {
                    MessageBox.Show("Вот вы и достигли вершины славы! Вам была выдана самая лучшая броня в игре! Поздравляем!");
                    try
                    {
                        ConnectToDatabase("root", "root");
                        string          commandText = String.Format("update SetOfArmor set Head = {0}, Body = {1}, Pants = {2}, Feets = {3}, LeftHand = {4}, RightHand = {5} where id_SetOfArmor = {6} ", 3, 2, 2, 2, 2, 2, Table0.Rows[0][6].ToString());
                        MySqlCommand    command     = new MySqlCommand(commandText, Connection);
                        MySqlDataReader dataReader;
                        dataReader = command.ExecuteReader();
                        RefreshInformation();
                        DisconnectFromDatabase();
                        GotCoolestWeapon = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                    }
                }
            }
            else
            {
                LevelBar.PerformStep();
                if (LevelBar.Value == LevelBar.Maximum)
                {
                    LevelBar.Value = LevelBar.Minimum;
                    ConnectToDatabase("root", "root");
                    string          commandText = String.Format("update `Character` set Level = {0} Where id_character = {1};", (Convert.ToInt32(Table0.Rows[0][8]) + 1).ToString(), NameOfCharacter);
                    MySqlCommand    command     = new MySqlCommand(commandText, Connection);
                    MySqlDataReader dataReader;
                    dataReader = command.ExecuteReader();
                    RefreshInformation();
                    DisconnectFromDatabase();
                }
                int value = Rand.Next(0, 10);
                DungeonProceed(value);
            }
        }
Esempio n. 4
0
        public (string, Widget) CreateSimpleLevelBar()
        {
            // constructor takes MinValue, MaxValue
            var lb = new LevelBar(0, 100);

            // lets add a visible request size in our example
            lb.WidthRequest = 100;

            // set the value to 75%
            lb.Value = 75d;

            return("Level Bar:", lb);
        }
 public void Start()
 {
     lb = this;
     iTween.Stop (fgColor.gameObject);
     fgColor.transform.localScale = new Vector3 (0,1,1);
     lvlText.transform.position = new Vector3 (-10, 4.7f, 0);
     lvlText.text = "";
     colorID = 0;
     words = 0;
     gameObject.camera.backgroundColor = bgColors[colorID];
     colorID++;
     fgColor.texture = fgColors[colorID];
     colorID++;
 }
Esempio n. 6
0
        private void CreateLevelBars()
        {
            var numPlayers = (from e in Players where e.Playing select e).Count();

            for (int x = 0; x < _levelBars.Length; x++)
            {
                _levelBars[x] = new LevelBar
                {
                    Parent     = this,
                    Size       = _metrics["LevelBarBase.Size", 0],
                    PlayerID   = x,
                    Multiplier = _gameType == GameType.SYNC_PLUS ? numPlayers : 1,
                    Position   = (_metrics["LevelBarBase", x])
                };
            }
        }
Esempio n. 7
0
    private void OnLevelWasLoaded(int level)
    {
        if (level == 1)
        {
            enemyBar = FindObjectOfType <LevelBar>();

            ProgressBar.s_meltBarSlider.value = ProgressBar.s_meltBarSlider.maxValue;
            enemyBar.slider.value             = 0;

            foreach (var obj in objsTo_enable_disable)
            {
                obj.SetActive(false);
            }

            if (Player == null)
            {
                Instantiate(Player, init_pos_for_Player, Quaternion.identity);
            }
        }
    }
Esempio n. 8
0
 /// <summary>
 /// Sets the level.
 /// </summary>
 /// <param name="bar">The progress bar.</param>
 /// <param name="stage">The stage to display until.</param>
 public static void SetLevel(ProgressBar bar, LevelBar stage)
 {
     bar.SetValue(LevelPropertyKey, stage);
 }
        static void Postfix(StandardLevelDetailView __instance, ref LevelParamsPanel ____levelParamsPanel, ref IDifficultyBeatmap ____selectedDifficultyBeatmap,
                            ref PlayerData ____playerData, ref LevelBar ____levelBar, ref UnityEngine.UI.Button ____actionButton,
                            ref UnityEngine.UI.Button ____practiceButton, ref BeatmapDifficultySegmentedControlController ____beatmapDifficultySegmentedControlController,
                            ref BeatmapCharacteristicSegmentedControlController ____beatmapCharacteristicSegmentedControlController)
        {
            bool firstSelection = false;
            var  level          = ____selectedDifficultyBeatmap.level is CustomBeatmapLevel ? ____selectedDifficultyBeatmap.level as CustomPreviewBeatmapLevel : null;

            if (level != lastLevel)
            {
                firstSelection = true;
                lastLevel      = level;
            }
            ____actionButton.interactable   = true;
            ____practiceButton.interactable = true;

            // ____levelBar.GetField<TextMeshProUGUI>("_songNameText").overflowMode = TextOverflowModes;
            //____songNameText.text = "<size=78%>" + ____songNameText.text.Replace(@"<", "<\u200B").Replace(@">", ">\u200B");
            //    ____songNameText.overflowMode = TextOverflowModes.Overflow;
            //     ____songNameText.enableWordWrapping = false;

            //____songNameText.richText = true;
            RequirementsUI.instance.ButtonGlowColor    = false;
            RequirementsUI.instance.ButtonInteractable = false;
            if (level != null)
            {
                Data.ExtraSongData songData = Collections.RetrieveExtraSongData(Utilities.Hashing.GetCustomLevelHash(level), level.customLevelPath);

                if (songData == null)
                {
                    RequirementsUI.instance.ButtonGlowColor    = false;
                    RequirementsUI.instance.ButtonInteractable = false;
                    return;
                }
                bool wipFolderSong = false;
                IDifficultyBeatmap selectedDiff            = ____selectedDifficultyBeatmap;
                Data.ExtraSongData.DifficultyData diffData = Collections.RetrieveDifficultyData(selectedDiff);
                //songData._difficulties?.FirstOrDefault(x => x._difficulty == selectedDiff.difficulty
                //&& (x._beatmapCharacteristicName == selectedDiff.parentDifficultyBeatmapSet.beatmapCharacteristic.characteristicName || x._beatmapCharacteristicName == selectedDiff.parentDifficultyBeatmapSet.beatmapCharacteristic.serializedName));
                if (diffData != null)
                {
                    //If no additional information is present
                    if (diffData.additionalDifficultyData._requirements.Count() == 0 && diffData.additionalDifficultyData._suggestions.Count() == 0 &&
                        diffData.additionalDifficultyData._warnings.Count() == 0 && diffData.additionalDifficultyData._information.Count() == 0 &&
                        songData.contributors.Count() == 0)
                    {
                        RequirementsUI.instance.ButtonGlowColor    = false;
                        RequirementsUI.instance.ButtonInteractable = false;
                    }
                    else if (diffData.additionalDifficultyData._warnings.Count() == 0)
                    {
                        RequirementsUI.instance.ButtonGlowColor    = true;
                        RequirementsUI.instance.ButtonInteractable = true;
                    }
                    else if (diffData.additionalDifficultyData._warnings.Count() > 0)
                    {
                        RequirementsUI.instance.ButtonGlowColor    = true;
                        RequirementsUI.instance.ButtonInteractable = true;
                        if (diffData.additionalDifficultyData._warnings.Contains("WIP"))
                        {
                            ____actionButton.interactable = false;
                        }
                    }
                }
                if (level.levelID.EndsWith(" WIP"))
                {
                    RequirementsUI.instance.ButtonGlowColor    = true;
                    RequirementsUI.instance.ButtonInteractable = true;
                    ____actionButton.interactable = false;
                    wipFolderSong = true;
                }
                if (diffData != null)
                {
                    for (int i = 0; i < diffData.additionalDifficultyData._requirements.Count(); i++)
                    {
                        if (!Collections.capabilities.Contains(diffData.additionalDifficultyData._requirements[i]))
                        {
                            ____actionButton.interactable              = false;
                            ____practiceButton.interactable            = false;
                            RequirementsUI.instance.ButtonGlowColor    = true;
                            RequirementsUI.instance.ButtonInteractable = true;
                        }
                    }
                }


                if (selectedDiff.parentDifficultyBeatmapSet.beatmapCharacteristic.serializedName == "MissingCharacteristic")
                {
                    ____actionButton.interactable              = false;
                    ____practiceButton.interactable            = false;
                    RequirementsUI.instance.ButtonGlowColor    = true;
                    RequirementsUI.instance.ButtonInteractable = true;
                }

                RequirementsUI.instance.level     = level;
                RequirementsUI.instance.songData  = songData;
                RequirementsUI.instance.diffData  = diffData;
                RequirementsUI.instance.wipFolder = wipFolderSong;


                //Difficulty Label Handling
                levelLabels.Clear();
                string currentCharacteristic = "";
                foreach (Data.ExtraSongData.DifficultyData diffLevel in songData._difficulties)
                {
                    var    difficulty     = diffLevel._difficulty;
                    string characteristic = diffLevel._beatmapCharacteristicName;
                    if (characteristic == selectedDiff.parentDifficultyBeatmapSet.beatmapCharacteristic.serializedName)
                    {
                        currentCharacteristic = characteristic;
                    }
                    if (!levelLabels.ContainsKey(characteristic))
                    {
                        levelLabels.Add(characteristic, new OverrideLabels());
                    }
                    OverrideLabels charLabels = levelLabels[characteristic];
                    if (!string.IsNullOrWhiteSpace(diffLevel._difficultyLabel))
                    {
                        switch (difficulty)
                        {
                        case BeatmapDifficulty.Easy:
                            charLabels.EasyOverride = diffLevel._difficultyLabel;
                            break;

                        case BeatmapDifficulty.Normal:
                            charLabels.NormalOverride = diffLevel._difficultyLabel;
                            break;

                        case BeatmapDifficulty.Hard:
                            charLabels.HardOverride = diffLevel._difficultyLabel;
                            break;

                        case BeatmapDifficulty.Expert:
                            charLabels.ExpertOverride = diffLevel._difficultyLabel;
                            break;

                        case BeatmapDifficulty.ExpertPlus:
                            charLabels.ExpertPlusOverride = diffLevel._difficultyLabel;
                            break;
                        }
                    }
                }
                if (!string.IsNullOrWhiteSpace(currentCharacteristic))
                {
                    SetCurrentLabels(levelLabels[currentCharacteristic]);
                }
                else
                {
                    clearOverrideLabels();
                }

                ____beatmapDifficultySegmentedControlController.SetData(____selectedDifficultyBeatmap.parentDifficultyBeatmapSet.difficultyBeatmaps, ____beatmapDifficultySegmentedControlController.selectedDifficulty);
                clearOverrideLabels();
                if (songData._defaultCharacteristic != null && firstSelection)
                {
                    if (____beatmapCharacteristicSegmentedControlController.selectedBeatmapCharacteristic.serializedName != songData._defaultCharacteristic)
                    {
                        var chars = ____beatmapCharacteristicSegmentedControlController.GetField <List <BeatmapCharacteristicSO>, BeatmapCharacteristicSegmentedControlController>("_beatmapCharacteristics");
                        int index = 0;
                        foreach (var characteristic in chars)
                        {
                            if (songData._defaultCharacteristic == characteristic.serializedName)
                            {
                                break;
                            }
                            index++;
                        }
                        if (index != chars.Count)
                        {
                            ____beatmapCharacteristicSegmentedControlController.GetField <HMUI.IconSegmentedControl, BeatmapCharacteristicSegmentedControlController>("_segmentedControl").SelectCellWithNumber(index);
                        }
                        ____beatmapCharacteristicSegmentedControlController.HandleDifficultySegmentedControlDidSelectCell(
                            ____beatmapCharacteristicSegmentedControlController.GetField <HMUI.IconSegmentedControl, BeatmapCharacteristicSegmentedControlController>("_segmentedControl"), index);
                    }
                }
            }
        }
 static bool Prefix(MissionLevelDetailViewController __instance, MissionNode ____missionNode, LevelBar ____levelBar, ObjectiveListItemsList ____objectiveListItems, GameplayModifiersModelSO ____gameplayModifiersModel, GameObject ____modifiersPanelGO, GameplayModifierInfoListItemsList ____gameplayModifierInfoListItemsList)
 {
     if (____missionNode.missionData is CustomMissionDataSO)
     {
         CustomMissionDataSO       missionData = (____missionNode.missionData as CustomMissionDataSO);
         CustomPreviewBeatmapLevel level       = missionData.customLevel;
         if (level == null)
         {
             // TODO: Localization?
             ____levelBar.GetPrivateField <TextMeshProUGUI>("_songNameText").text   = "SONG NOT FOUND";
             ____levelBar.GetPrivateField <TextMeshProUGUI>("_difficultyText").text = "SONG NOT FOUND";
             ____levelBar.GetPrivateField <TextMeshProUGUI>("_authorNameText").text = "SONG NOT FOUND";
         }
         else
         {
             ____levelBar.Setup(level, missionData.beatmapCharacteristic, missionData.beatmapDifficulty);
         }
         MissionObjective[] missionObjectives = missionData.missionObjectives;
         ____objectiveListItems.SetData((missionObjectives.Length == 0) ? 1 : missionObjectives.Length, delegate(int idx, ObjectiveListItem objectiveListItem)
         {
             if (idx == 0 && missionObjectives.Length == 0)
             {
                 objectiveListItem.title         = Localization.Get("CAMPAIGN_FINISH_LEVEL");
                 objectiveListItem.conditionText = "";
                 objectiveListItem.hideCondition = true;
             }
             else
             {
                 MissionObjective missionObjective = missionObjectives[idx];
                 if (missionObjective.type.noConditionValue)
                 {
                     objectiveListItem.title         = missionObjective.type.objectiveNameLocalized.Replace(" ", "\n");
                     objectiveListItem.hideCondition = true;
                 }
                 else
                 {
                     objectiveListItem.title         = missionObjective.type.objectiveNameLocalized;
                     objectiveListItem.hideCondition = false;
                     ObjectiveValueFormatterSO objectiveValueFormater = missionObjective.type.objectiveValueFormater;
                     objectiveListItem.conditionText = $"{MissionDataExtensions.Name(missionObjective.referenceValueComparisonType)} {objectiveValueFormater.FormatValue(missionObjective.referenceValue)}";
                 }
             }
         });
         List <GameplayModifierParamsSO> modifierParamsList = ____gameplayModifiersModel.GetModifierParams(missionData.gameplayModifiers);
         ____modifiersPanelGO.SetActive(modifierParamsList.Count > 0);
         ____gameplayModifierInfoListItemsList.SetData(modifierParamsList.Count, delegate(int idx, GameplayModifierInfoListItem gameplayModifierInfoListItem)
         {
             GameplayModifierParamsSO gameplayModifierParamsSO = modifierParamsList[idx];
             gameplayModifierInfoListItem.modifierIcon         = gameplayModifierParamsSO.icon;
             gameplayModifierInfoListItem.hoverHintText        = Localization.Get(gameplayModifierParamsSO.modifierNameLocalizationKey) + " - " + Localization.Get(gameplayModifierParamsSO.descriptionLocalizationKey);
         });
         return(false);
     }
     return(true);
 }