示例#1
0
 private static void CCGiveRandomItems(ConCommandArgs args)
 {
     if (args.Count == 0)
     {
         return;
     }
     if (args.senderMasterObject)
     {
         Inventory component = args.senderMasterObject.GetComponent <Inventory>();
         if (component)
         {
             try
             {
                 int num;
                 TextSerialization.TryParseInvariant(args[0], out num);
                 if (num > 0)
                 {
                     WeightedSelection <List <PickupIndex> > weightedSelection = new WeightedSelection <List <PickupIndex> >(8);
                     weightedSelection.AddChoice(Run.instance.availableTier1DropList, 80f);
                     weightedSelection.AddChoice(Run.instance.availableTier2DropList, 19f);
                     weightedSelection.AddChoice(Run.instance.availableTier3DropList, 1f);
                     for (int i = 0; i < num; i++)
                     {
                         List <PickupIndex> list = weightedSelection.Evaluate(UnityEngine.Random.value);
                         component.GiveItem(list[UnityEngine.Random.Range(0, list.Count)].itemIndex, 1);
                     }
                 }
             }
             catch (ArgumentException)
             {
             }
         }
     }
 }
示例#2
0
 private static void CCGiveMoney(ConCommandArgs args)
 {
     if (args.Count == 0)
     {
         return;
     }
     if (args.senderMasterObject)
     {
         CharacterMaster component = args.senderMasterObject.GetComponent <CharacterMaster>();
         if (component)
         {
             try
             {
                 int num = 1;
                 if (args.Count > 0)
                 {
                     TextSerialization.TryParseInvariant(args[0], out num);
                 }
                 component.money += (uint)num;
             }
             catch (ArgumentException)
             {
             }
         }
     }
 }
示例#3
0
        private static void CCUseSeed(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                string s = "Current Seed is ";
                if (PreGameController.instance)
                {
                    s += PreGameController.instance.runSeed;
                }
                else
                {
                    s += (seed == 0) ? "random" : seed.ToString();
                }
                Log.Message(s);
                return;
            }
            args.CheckArgumentCount(1);
            if (!TextSerialization.TryParseInvariant(args[0], out ulong result))
            {
                throw new ConCommandException("Specified seed is not a parsable uint64.");
            }

            if (PreGameController.instance)
            {
                PreGameController.instance.runSeed = (result == 0) ? RoR2Application.rng.nextUlong  : result;
            }
            seed = result;
            Log.Message($"Seed set to {((seed == 0) ? "vanilla generation" : seed.ToString())}.");
        }
示例#4
0
    public static IEnumerator Setup() {
        ready = false;
        var hudConVar = RoR2.Console.instance.FindConVar("hud_scale");

        if (Config.UI.useHUDScale)
        {
            if (hudConVar != null && TextSerialization.TryParseInvariant(hudConVar.GetString(), out float num))
            {
                hudScale = num / 100f;
            }
        }
        else {
            hudScale = Config.UI.overrideHUDScale;
        }

        while (!ready) {
            yield return new WaitForSeconds(0.1f);
            if (LocalUserManager.GetFirstLocalUser() != null && LocalUserManager.GetFirstLocalUser()?.cameraRigController?.hud != null) {
                screenSize = LocalUserManager.GetFirstLocalUser()?.cameraRigController?.hud.GetComponent<RectTransform>().sizeDelta ?? new Vector2(0,0);
                if (!(screenSize.x <= 1 || screenSize.y <= 1)) {
                    ready = true;
                };
            }
        }
    }
示例#5
0
        private static void CCGiveMoney(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                return;
            }

            if (!TextSerialization.TryParseInvariant(args[0], out uint result))
            {
                return;
            }

            if (args.Count < 2 || args[1].ToLower() != "all")
            {
                CharacterMaster master = args.sender.master;
                if (args.Count >= 2)
                {
                    NetworkUser player = GetNetUserFromString(args[1]);
                    if (player != null)
                    {
                        master = player.master;
                    }
                }
                master.GiveMoney(result);
            }
            else
            {
                TeamManager.instance.GiveTeamMoney(args.sender.master.teamIndex, result);
            }
            Log.Message("$$$");
        }
示例#6
0
        private static void CCSplitscreenModNoKeyboard(ConCommandArgs args)
        {
            int num = 2;
            int value;

            if (args.Count >= 1 && TextSerialization.TryParseInvariant(args[0], out value))
            {
                num = Mathf.Clamp(value, 1, 4);
            }
            if (!NetworkClient.active)
            {
                UserProfile mainProfile = LocalUserManager.GetFirstLocalUser().userProfile;
                LocalUserManager.ClearUsers();
                LocalUserManager.LocalUserInitializationInfo[] array = new LocalUserManager.LocalUserInitializationInfo[num];
                array[0].player  = ReInput.players.GetPlayer(2);
                array[0].profile = mainProfile;
                if (array[0].profile == null)
                {
                    array[0].profile = UserProfile.CreateGuestProfile();
                    print("SplitscreenMod: Profile could not be loaded. Using guest profile.");
                }
                for (int i = 1; i < num; i++)
                {
                    array[i] = new LocalUserManager.LocalUserInitializationInfo
                    {
                        player  = ReInput.players.GetPlayer(2 + i),
                        profile = UserProfile.CreateGuestProfile()
                    };
                }
                LocalUserManager.SetLocalUsers(array);
            }
        }
示例#7
0
文件: UI.cs 项目: ben2882/RPGMod
            // Methods
            private void Awake()
            {
                questUI = Instantiate(Core.assetBundle.LoadAsset <GameObject>("Assets/QuestUI.prefab"));

                var hudConVar = RoR2.Console.instance.FindConVar("hud_scale");

                if (Questing.Config.useGameHudScale)
                {
                    if (hudConVar != null && TextSerialization.TryParseInvariant(hudConVar.GetString(), out float num))
                    {
                        hudScale = num / 100f;
                    }
                }
                else
                {
                    hudScale = 1f;
                }

                iconBorder           = questUI.transform.Find("iconBorder");
                backgroundBorder     = questUI.transform.Find("backgroundBorder");
                infoBackground       = questUI.transform.Find("background");
                objectiveIconHolder  = iconBorder.Find("icon");
                titleField           = infoBackground.Find("title");
                descriptionField     = infoBackground.Find("description");
                rewardField          = infoBackground.Find("reward");
                equipIconBorder      = infoBackground.Find("equipIconBorder");
                equipIconHolder      = equipIconBorder.Find("equipIcon");
                progressBackground   = infoBackground.Find("progressBackground");
                progressBarPrimary   = progressBackground.Find("progressBarPrimary");
                progressBarSecondary = progressBackground.Find("progressBarSecondary");
                progressField        = progressBackground.Find("progress");

                primaryBarTransform   = progressBarPrimary.GetComponent <RectTransform>();
                secondaryBarTransform = progressBarSecondary.GetComponent <RectTransform>();
            }
示例#8
0
 private static void CCGiveItem(ConCommandArgs args)
 {
     if (args.Count == 0)
     {
         return;
     }
     if (args.senderMasterObject)
     {
         Inventory component = args.senderMasterObject.GetComponent <Inventory>();
         if (component)
         {
             try
             {
                 int count = 1;
                 if (args.Count > 1)
                 {
                     TextSerialization.TryParseInvariant(args[1], out count);
                 }
                 component.GiveItem((ItemIndex)Enum.Parse(typeof(ItemIndex), args[0]), count);
             }
             catch (ArgumentException)
             {
             }
         }
     }
 }
示例#9
0
        private static void CCTimeScale(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                Log.Message(Time.timeScale);
                return;
            }

            if (TextSerialization.TryParseInvariant(args[0], out float scale))
            {
                Time.timeScale = scale;
                Log.Message("Time scale set to " + scale);
            }
            else
            {
                Log.Message("Incorrect arguments. Try: time_scale 0.5");
            }

            NetworkWriter networkWriter = new NetworkWriter();

            networkWriter.StartMessage(101);
            networkWriter.Write((double)Time.timeScale);

            networkWriter.FinishMessage();
            NetworkServer.SendWriterToReady(null, networkWriter, QosChannelIndex.time.intVal);
        }
示例#10
0
            private void RecalcBarRect()
            {
                this.width  = Screen.width;
                this.height = Screen.height;
                TextSerialization.TryParseInvariant(this.scaleVar.GetString(), out this.scale);

                Single barWidth  = this.width * this.barWidthFrac * this.scale / 100;
                Single barHeight = this.height * this.barHeightFrac * this.scale / 100;

                Single spaceSize = barHeight * this.spaceFrac / 10;
                Single barSize   = spaceSize * this.boxHeightFrac;

                this.boxesSpacing = spaceSize;
                this.boxesH       = barSize;
                this.boxesW       = barWidth;

                this.boxesStartH = this.width * this.barPosHFrac;

                Single barV = this.height * this.barPosVFrac;

                this.boxesStartV = barV - (barHeight / 4f);

                this.texW = Mathf.CeilToInt(this.boxesW / 2f);
                this.texH = Mathf.CeilToInt(this.boxesH / 2f);

                for (Int32 i = 0; i < 10; i++)
                {
                    this.boxes[i] = new Rect(this.boxesStartH, this.boxesStartV + (i * (spaceSize)), this.boxesW, this.boxesH);
                }

                this.CreateTextures();
            }
示例#11
0
            // Token: 0x0600193D RID: 6461 RVA: 0x0006CF7C File Offset: 0x0006B17C
            public override void SetString(string newValue)
            {
                string[] array = newValue.Split(new char[]
                {
                    'x'
                });
                int width;

                if (array.Length < 1 || !TextSerialization.TryParseInvariant(array[0], out width))
                {
                    throw new ConCommandException("Invalid resolution format. No width integer. Example: \"1920x1080x60\".");
                }
                int height;

                if (array.Length < 2 || !TextSerialization.TryParseInvariant(array[1], out height))
                {
                    throw new ConCommandException("Invalid resolution format. No height integer. Example: \"1920x1080x60\".");
                }
                int preferredRefreshRate;

                if (array.Length < 3 || !TextSerialization.TryParseInvariant(array[2], out preferredRefreshRate))
                {
                    throw new ConCommandException("Invalid resolution format. No refresh rate integer. Example: \"1920x1080x60\".");
                }
                Screen.SetResolution(width, height, Screen.fullScreenMode, preferredRefreshRate);
            }
 // Token: 0x060023AE RID: 9134 RVA: 0x000A7C67 File Offset: 0x000A5E67
 private void OnSliderValueChanged(float newValue)
 {
     if (base.inUpdateControls)
     {
         return;
     }
     base.SubmitSetting(TextSerialization.ToStringInvariant(newValue));
 }
示例#13
0
 // Token: 0x06001B2F RID: 6959 RVA: 0x0007F604 File Offset: 0x0007D804
 protected override string RebuildValue()
 {
     if (this.groupId == CSteamID.nil)
     {
         return(null);
     }
     return(TextSerialization.ToStringInvariant(this.groupId.value));
 }
示例#14
0
 // Token: 0x0600197F RID: 6527 RVA: 0x0006D7B0 File Offset: 0x0006B9B0
 public override string GetString()
 {
     if (!SettingsConVars.PpGammaConVar.colorGradingSettings)
     {
         return("0");
     }
     return(TextSerialization.ToStringInvariant(SettingsConVars.PpGammaConVar.colorGradingSettings.gamma.value.w));
 }
示例#15
0
            // Token: 0x0600197E RID: 6526 RVA: 0x0006D778 File Offset: 0x0006B978
            public override void SetString(string newValue)
            {
                float w;

                if (TextSerialization.TryParseInvariant(newValue, out w) && SettingsConVars.PpGammaConVar.colorGradingSettings)
                {
                    SettingsConVars.PpGammaConVar.colorGradingSettings.gamma.value.w = w;
                }
            }
示例#16
0
            // Token: 0x0600197A RID: 6522 RVA: 0x0006D6DC File Offset: 0x0006B8DC
            public override void SetString(string newValue)
            {
                int num;

                if (TextSerialization.TryParseInvariant(newValue, out num) && SettingsConVars.PpAOConVar.settings)
                {
                    SettingsConVars.PpAOConVar.settings.active = (num == 0);
                }
            }
示例#17
0
            // Token: 0x0600196A RID: 6506 RVA: 0x0006D470 File Offset: 0x0006B670
            public override void SetString(string newValue)
            {
                float shadowDistance;

                if (TextSerialization.TryParseInvariant(newValue, out shadowDistance))
                {
                    QualitySettings.shadowDistance = shadowDistance;
                }
            }
示例#18
0
            // Token: 0x06001966 RID: 6502 RVA: 0x0006D42C File Offset: 0x0006B62C
            public override void SetString(string newValue)
            {
                int shadowCascades;

                if (TextSerialization.TryParseInvariant(newValue, out shadowCascades))
                {
                    QualitySettings.shadowCascades = shadowCascades;
                }
            }
示例#19
0
            // Token: 0x0600195A RID: 6490 RVA: 0x0006D2DC File Offset: 0x0006B4DC
            public override void SetString(string newValue)
            {
                int masterTextureLimit;

                if (TextSerialization.TryParseInvariant(newValue, out masterTextureLimit))
                {
                    QualitySettings.masterTextureLimit = masterTextureLimit;
                }
            }
示例#20
0
            // Token: 0x06001956 RID: 6486 RVA: 0x0006D298 File Offset: 0x0006B498
            public override void SetString(string newValue)
            {
                int maximumLODLevel;

                if (TextSerialization.TryParseInvariant(newValue, out maximumLODLevel))
                {
                    QualitySettings.maximumLODLevel = maximumLODLevel;
                }
            }
            // Token: 0x06000B48 RID: 2888 RVA: 0x00037DC0 File Offset: 0x00035FC0
            public override void SetString(string newValue)
            {
                float value;

                if (AkSoundEngine.IsInitialized() && TextSerialization.TryParseInvariant(newValue, out value))
                {
                    AkSoundEngine.SetRTPCValue(this.rtpcName, Mathf.Clamp(value, 0f, 100f));
                }
            }
示例#22
0
            // Token: 0x0600194A RID: 6474 RVA: 0x0006D19C File Offset: 0x0006B39C
            public override void SetString(string newValue)
            {
                int num;

                if (TextSerialization.TryParseInvariant(newValue, out num))
                {
                    QualitySettings.softParticles = (num != 0);
                }
            }
示例#23
0
            // Token: 0x06001935 RID: 6453 RVA: 0x0006CE68 File Offset: 0x0006B068
            public override void SetString(string newValue)
            {
                int vSyncCount;

                if (TextSerialization.TryParseInvariant(newValue, out vSyncCount))
                {
                    QualitySettings.vSyncCount = vSyncCount;
                }
            }
示例#24
0
            // Token: 0x06001942 RID: 6466 RVA: 0x0006D0D0 File Offset: 0x0006B2D0
            public override void SetString(string newValue)
            {
                int targetFrameRate;

                if (TextSerialization.TryParseInvariant(newValue, out targetFrameRate))
                {
                    Application.targetFrameRate = targetFrameRate;
                }
            }
示例#25
0
        // Token: 0x06002538 RID: 9528 RVA: 0x000AEC90 File Offset: 0x000ACE90
        public override void SetString(string newValue)
        {
            int num;

            if (TextSerialization.TryParseInvariant(newValue, out num))
            {
                this.value = (num != 0);
            }
        }
        // Token: 0x0600253D RID: 9533 RVA: 0x000AECD8 File Offset: 0x000ACED8
        public override void SetString(string newValue)
        {
            int value;

            if (TextSerialization.TryParseInvariant(newValue, out value))
            {
                this.value = value;
            }
        }
            // Token: 0x06000B4B RID: 2891 RVA: 0x00037E48 File Offset: 0x00036048
            public override void SetString(string newValue)
            {
                int num;

                if (TextSerialization.TryParseInvariant(newValue, out num))
                {
                    AkSoundEngineController.s_MuteOnFocusLost = (num != 0);
                }
            }
示例#28
0
            // Token: 0x06001952 RID: 6482 RVA: 0x0006D254 File Offset: 0x0006B454
            public override void SetString(string newValue)
            {
                float lodBias;

                if (TextSerialization.TryParseInvariant(newValue, out lodBias))
                {
                    QualitySettings.lodBias = lodBias;
                }
            }
示例#29
0
        public override void SetString(string newValue)
        {
            float num;

            if (TextSerialization.TryParseInvariant(newValue, out num) && !float.IsNaN(num) && !float.IsInfinity(num))
            {
                this.value = num;
            }
        }
示例#30
0
            public void FixedUpdate()
            {
                Single temp = 0f;

                if (Screen.width != this.width || Screen.height != this.height || (TextSerialization.TryParseInvariant(this.scaleVar.GetString(), out temp) && temp != this.scale))
                {
                    this.RecalcBarRect();
                }
            }