private void PopulateSavedVariables()
        {
            foreach (GlobalVariable var in Enum.GetValues(typeof(GlobalVariable)))
            {
                int index = TheEditor.GetIndexOfGlobal(var);
                if (index == -1)
                {
                    continue;
                }

                Globals.Add(new GlobalVariableInfo()
                {
                    Index      = index,
                    IntValue   = TheEditor.GetGlobal(var),
                    FloatValue = TheEditor.GetGlobalAsFloat(var),
                    Name       = var.ToString()
                });
            }
        }
        private void PopulateAllVariables()
        {
            for (int i = 0, enumIndex = 0; i < TheEditor.GetNumGlobals(); i++, enumIndex++)
            {
                while (TheEditor.GetIndexOfGlobal((GlobalVariable)enumIndex) < i)
                {
                    enumIndex++;
                }

                string name = Enum.GetName(typeof(GlobalVariable), enumIndex);
                Globals.Add(new GlobalVariableInfo()
                {
                    Index      = i,
                    IntValue   = TheEditor.GetGlobal(i),
                    FloatValue = TheEditor.GetGlobalAsFloat(i),
                    Name       = name
                });
            }
        }
Example #3
0
        private void GlobalVariables_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Action != NotifyCollectionChangedAction.Replace)
            {
                return;
            }

            int  packageMin   = TheEditor.GetIndexOfGlobal(GlobalVariable.Package1Collected);
            int  packageMax   = TheEditor.GetIndexOfGlobal(GlobalVariable.Package100Collected);
            int  rampageMin   = TheEditor.GetIndexOfGlobal(GlobalVariable.Rampage1Passed);
            int  rampageMax   = TheEditor.GetIndexOfGlobal(GlobalVariable.Rampage20Passed);
            int  stuntJumpMin = TheEditor.GetIndexOfGlobal(GlobalVariable.StuntJump1Completed);
            int  stuntJumpMax = TheEditor.GetIndexOfGlobal(GlobalVariable.StuntJump26Completed);
            int  index        = e.NewStartingIndex;
            bool isCollected  = ((int)e.NewItems[0]) != 0;

            CollectibleBlip blip = null;

            if (index >= packageMin && index <= packageMax)
            {
                blip = Blips.Where(x => x.Type == BlipType.Package && x.Index == (index - packageMin)).FirstOrDefault();
            }
            if (index >= rampageMin && index <= rampageMax)
            {
                blip = Blips.Where(x => x.Type == BlipType.Rampage && x.Index == (index - rampageMin)).FirstOrDefault();
            }
            if (index >= stuntJumpMin && index <= stuntJumpMax)
            {
                blip = Blips.Where(x => x.Type == BlipType.StuntJump && x.Index == (index - stuntJumpMin)).FirstOrDefault();
            }

            if (blip != null)
            {
                blip.IsCollected = isCollected;
                if (!isCollected || (isCollected && IsShowingCollected))
                {
                    blip.IsEnabled = true;
                }
            }
        }