private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(Lock state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  Lock.Locked:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "BackgroundSprite.Texture Left",
                    Type      = "int",
                    Value     = BackgroundSprite.TextureLeft + 256
                }
                                       );
                break;

            case  Lock.NotLocked:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "BackgroundSprite.Texture Left",
                    Type      = "int",
                    Value     = BackgroundSprite.TextureLeft + 0
                }
                                       );
                break;
            }
            return(newState);
        }
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                }
                else if (category.Name == "Lock")
                {
                    if (state.Name == "Locked")
                    {
                        this.mCurrentLockState = Lock.Locked;
                    }
                    if (state.Name == "NotLocked")
                    {
                        this.mCurrentLockState = Lock.NotLocked;
                    }
                }
            }
            base.ApplyState(state);
        }
Esempio n. 3
0
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                }
                else if (category.Name == "EnabledStatus")
                {
                    if (state.Name == "Enabled")
                    {
                        this.mCurrentEnabledStatusState = EnabledStatus.Enabled;
                    }
                    if (state.Name == "Unaffordable")
                    {
                        this.mCurrentEnabledStatusState = EnabledStatus.Unaffordable;
                    }
                    if (state.Name == "Disabled")
                    {
                        this.mCurrentEnabledStatusState = EnabledStatus.Disabled;
                    }
                }
            }
            base.ApplyState(state);
        }
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                    if (state.Name == "PlayerSelection")
                    {
                        this.mCurrentVariableState = VariableState.PlayerSelection;
                    }
                    if (state.Name == "Game")
                    {
                        this.mCurrentVariableState = VariableState.Game;
                    }
                }
            }
            base.ApplyState(state);
        }
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(RadioButtonCategory state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  RadioButtonCategory.EnabledOn:
                break;

            case  RadioButtonCategory.EnabledOff:
                break;

            case  RadioButtonCategory.DisabledOn:
                break;

            case  RadioButtonCategory.DisabledOff:
                break;

            case  RadioButtonCategory.HighlightedOn:
                break;

            case  RadioButtonCategory.HighlightedOff:
                break;

            case  RadioButtonCategory.PushedOn:
                break;

            case  RadioButtonCategory.PushedOff:
                break;
            }
            return(newState);
        }
Esempio n. 6
0
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                }
                else if (category.Name == "CreditType")
                {
                    if (state.Name == "Header")
                    {
                        this.mCurrentCreditTypeState = CreditType.Header;
                    }
                    if (state.Name == "Detail")
                    {
                        this.mCurrentCreditTypeState = CreditType.Detail;
                    }
                }
            }
            base.ApplyState(state);
        }
Esempio n. 7
0
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(Fading state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  Fading.Faded:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "BlackFade.Alpha",
                    Type      = "int",
                    Value     = BlackFade.Alpha + 255
                }
                                       );
                break;

            case  Fading.NotFaded:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "BlackFade.Alpha",
                    Type      = "int",
                    Value     = BlackFade.Alpha + 0
                }
                                       );
                break;
            }
            return(newState);
        }
Esempio n. 8
0
 private System.Collections.Generic.IEnumerable <FlatRedBall.Instructions.Instruction> FadeOutAnimationRelativeInstructions(object target)
 {
     {
     }
     {
         var toReturn = new FlatRedBall.Instructions.DelegateInstruction(() =>
         {
             var relativeStart = ElementSave.AllStates.FirstOrDefault(item => item.Name == "Fading/NotFaded").Clone();
             var relativeEnd   = ElementSave.AllStates.FirstOrDefault(item => item.Name == "Fading/Faded").Clone();
             Gum.DataTypes.Variables.StateSaveExtensionMethods.SubtractFromThis(relativeEnd, relativeStart);
             var difference = relativeEnd;
             Gum.DataTypes.Variables.StateSave first  = GetCurrentValuesOnState(Fading.Faded);
             Gum.DataTypes.Variables.StateSave second = first.Clone();
             Gum.DataTypes.Variables.StateSaveExtensionMethods.AddIntoThis(second, difference);
             FlatRedBall.Glue.StateInterpolation.Tweener tweener = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: 1, type: FlatRedBall.Glue.StateInterpolation.InterpolationType.Linear, easing: FlatRedBall.Glue.StateInterpolation.Easing.Out);
             tweener.Owner           = this;
             tweener.PositionChanged = newPosition => this.InterpolateBetween(first, second, newPosition);
             tweener.Start();
             StateInterpolationPlugin.TweenerManager.Self.Add(tweener);
         }
                                                                         );
         toReturn.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + 0;
         toReturn.Target        = target;
         yield return(toReturn);
     }
 }
Esempio n. 9
0
        private void GetRegularVariableFileReferences(List <string> listToFill, Gum.DataTypes.Variables.StateSave state, IList <InstanceSave> instances, ProjectOrDisk projectOrDisk)
        {
            var fileVariables = state.Variables
                                .Where(item => item.IsFile && !string.IsNullOrEmpty(item.Value as string))
                                .ToArray();

            foreach (var variable in fileVariables)
            {
                bool isGraphicFile = FileManager.IsGraphicFile(variable.Value as string);

                bool shouldConsider = !UseAtlases || !isGraphicFile || projectOrDisk == ProjectOrDisk.Disk;

                var instanceName = variable.SourceObject;

                if (shouldConsider && !string.IsNullOrEmpty(instanceName))
                {
                    // make sure this isn't a left-over variable reference
                    var foundInstance = instances.FirstOrDefault(item => item.Name == instanceName);

                    shouldConsider = foundInstance != null;
                }

                if (shouldConsider)
                {
                    if (IsNineSliceSource(variable, state))
                    {
                        string variableValue = variable.Value as string;

                        var shouldUsePattern = RenderingLibrary.Graphics.NineSlice.GetIfShouldUsePattern(variableValue);

                        if (shouldUsePattern)
                        {
                            string extension = FileManager.GetExtension(variableValue);

                            string variableWithoutExtension = FileManager.RemoveExtension(variableValue);

                            string bareTexture = RenderingLibrary.Graphics.NineSlice.GetBareTextureForNineSliceTexture(
                                variableValue);

                            foreach (var side in RenderingLibrary.Graphics.NineSlice.PossibleNineSliceEndings)
                            {
                                listToFill.Add(FileManager.RelativeDirectory + bareTexture + side + "." + extension);
                            }
                        }
                        else
                        {
                            listToFill.Add(FileManager.RelativeDirectory + variableValue);
                        }
                    }
                    else
                    {
                        string absoluteFileName = FileManager.RelativeDirectory + variable.Value as string;
                        absoluteFileName = FileManager.RemoveDotDotSlash(absoluteFileName);

                        listToFill.Add(absoluteFileName);
                    }
                }
            }
        }
 public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateTo(Gum.DataTypes.Variables.StateSave first, Gum.DataTypes.Variables.StateSave second, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing)
 {
     FlatRedBall.Glue.StateInterpolation.Tweener tweener = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing);
     tweener.Owner           = this;
     tweener.PositionChanged = newPosition => this.InterpolateBetween(first, second, newPosition);
     tweener.Start();
     StateInterpolationPlugin.TweenerManager.Self.Add(tweener);
     return(tweener);
 }
 private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(VariableState state)
 {
     Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
     switch (state)
     {
     case  VariableState.Default:
         break;
     }
     return(newState);
 }
Esempio n. 12
0
 public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateToRelative(VariableState toState, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing)
 {
     Gum.DataTypes.Variables.StateSave           current       = GetCurrentValuesOnState(toState);
     Gum.DataTypes.Variables.StateSave           toAsStateSave = AddToCurrentValuesWithState(toState);
     FlatRedBall.Glue.StateInterpolation.Tweener tweener       = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing);
     tweener.Owner           = this;
     tweener.PositionChanged = newPosition => this.InterpolateBetween(current, toAsStateSave, newPosition);
     tweener.Start();
     StateInterpolationPlugin.TweenerManager.Self.Add(tweener);
     return(tweener);
 }
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                }
                else if (category.Name == "RadioButtonCategory")
                {
                    if (state.Name == "EnabledOn")
                    {
                        this.mCurrentRadioButtonCategoryState = RadioButtonCategory.EnabledOn;
                    }
                    if (state.Name == "EnabledOff")
                    {
                        this.mCurrentRadioButtonCategoryState = RadioButtonCategory.EnabledOff;
                    }
                    if (state.Name == "DisabledOn")
                    {
                        this.mCurrentRadioButtonCategoryState = RadioButtonCategory.DisabledOn;
                    }
                    if (state.Name == "DisabledOff")
                    {
                        this.mCurrentRadioButtonCategoryState = RadioButtonCategory.DisabledOff;
                    }
                    if (state.Name == "HighlightedOn")
                    {
                        this.mCurrentRadioButtonCategoryState = RadioButtonCategory.HighlightedOn;
                    }
                    if (state.Name == "HighlightedOff")
                    {
                        this.mCurrentRadioButtonCategoryState = RadioButtonCategory.HighlightedOff;
                    }
                    if (state.Name == "PushedOn")
                    {
                        this.mCurrentRadioButtonCategoryState = RadioButtonCategory.PushedOn;
                    }
                    if (state.Name == "PushedOff")
                    {
                        this.mCurrentRadioButtonCategoryState = RadioButtonCategory.PushedOff;
                    }
                }
            }
            base.ApplyState(state);
        }
Esempio n. 14
0
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(SunLevel state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  SunLevel.Level1:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "SpriteInstance.Texture Left",
                    Type      = "int",
                    Value     = SpriteInstance.TextureLeft + 164
                }
                                       );
                break;

            case  SunLevel.Level2:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "SpriteInstance.Texture Left",
                    Type      = "int",
                    Value     = SpriteInstance.TextureLeft + 229
                }
                                       );
                break;

            case  SunLevel.Level3:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "SpriteInstance.Texture Left",
                    Type      = "int",
                    Value     = SpriteInstance.TextureLeft + 294
                }
                                       );
                break;

            case  SunLevel.Level4:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "SpriteInstance.Texture Left",
                    Type      = "int",
                    Value     = SpriteInstance.TextureLeft + 359
                }
                                       );
                break;
            }
            return(newState);
        }
Esempio n. 15
0
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(WindLevel state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  WindLevel.Level1:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "WindSprite.Texture Left",
                    Type      = "int",
                    Value     = WindSprite.TextureLeft + 423
                }
                                       );
                break;

            case  WindLevel.Level2:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "WindSprite.Texture Left",
                    Type      = "int",
                    Value     = WindSprite.TextureLeft + 488
                }
                                       );
                break;

            case  WindLevel.Level3:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "WindSprite.Texture Left",
                    Type      = "int",
                    Value     = WindSprite.TextureLeft + 553
                }
                                       );
                break;

            case  WindLevel.Level4:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "WindSprite.Texture Left",
                    Type      = "int",
                    Value     = WindSprite.TextureLeft + 618
                }
                                       );
                break;
            }
            return(newState);
        }
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                    if (state.Name == "Brown")
                    {
                        this.mCurrentVariableState = VariableState.Brown;
                    }
                    if (state.Name == "Orange")
                    {
                        this.mCurrentVariableState = VariableState.Orange;
                    }
                    if (state.Name == "DarkBlue")
                    {
                        this.mCurrentVariableState = VariableState.DarkBlue;
                    }
                    if (state.Name == "Green")
                    {
                        this.mCurrentVariableState = VariableState.Green;
                    }
                    if (state.Name == "Blue")
                    {
                        this.mCurrentVariableState = VariableState.Blue;
                    }
                    if (state.Name == "Teal")
                    {
                        this.mCurrentVariableState = VariableState.Teal;
                    }
                    if (state.Name == "Yellow")
                    {
                        this.mCurrentVariableState = VariableState.Yellow;
                    }
                    if (state.Name == "Purple")
                    {
                        this.mCurrentVariableState = VariableState.Purple;
                    }
                }
            }
            base.ApplyState(state);
        }
Esempio n. 17
0
        private void GetRegularVariableFileReferences(List <string> listToFill, Gum.DataTypes.Variables.StateSave state, ProjectOrDisk projectOrDisk)
        {
            foreach (var variable in state.Variables.Where(item => item.IsFile))
            {
                if (!string.IsNullOrEmpty(variable.Value as string))
                {
                    bool isGraphicFile = FileManager.IsGraphicFile(variable.Value as string);

                    bool shouldConsider = !UseAtlases || !isGraphicFile || projectOrDisk == ProjectOrDisk.Disk;

                    if (shouldConsider)
                    {
                        if (IsNineSliceSource(variable, state))
                        {
                            string variableValue = variable.Value as string;

                            var shouldUsePattern = RenderingLibrary.Graphics.NineSlice.GetIfShouldUsePattern(variableValue);

                            if (shouldUsePattern)
                            {
                                string extension = FileManager.GetExtension(variableValue);

                                string variableWithoutExtension = FileManager.RemoveExtension(variableValue);

                                string bareTexture = RenderingLibrary.Graphics.NineSlice.GetBareTextureForNineSliceTexture(
                                    variableValue);

                                foreach (var side in RenderingLibrary.Graphics.NineSlice.PossibleNineSliceEndings)
                                {
                                    listToFill.Add(FileManager.RelativeDirectory + bareTexture + side + "." + extension);
                                }
                            }
                            else
                            {
                                listToFill.Add(FileManager.RelativeDirectory + variableValue);
                            }
                        }
                        else
                        {
                            string absoluteFileName = FileManager.RelativeDirectory + variable.Value as string;
                            absoluteFileName = FileManager.RemoveDotDotSlash(absoluteFileName);

                            listToFill.Add(absoluteFileName);
                        }
                    }
                }
            }
        }
Esempio n. 18
0
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(EnabledStatus state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  EnabledStatus.Enabled:
                break;

            case  EnabledStatus.Unaffordable:
                break;

            case  EnabledStatus.Disabled:
                break;
            }
            return(newState);
        }
 private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(VariableState state)
 {
     Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
     switch (state)
     {
     case  VariableState.Default:
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "TechnologyTreeInstance.Visible",
             Type      = "bool",
             Value     = TechnologyTreeInstance.Visible
         }
                                );
         break;
     }
     return(newState);
 }
Esempio n. 20
0
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                }
                else if (category.Name == "DamageType")
                {
                    if (state.Name == "Piercing")
                    {
                        this.mCurrentDamageTypeState = DamageType.Piercing;
                    }
                    if (state.Name == "Bombarding")
                    {
                        this.mCurrentDamageTypeState = DamageType.Bombarding;
                    }
                    if (state.Name == "Chemical")
                    {
                        this.mCurrentDamageTypeState = DamageType.Chemical;
                    }
                    if (state.Name == "Frost")
                    {
                        this.mCurrentDamageTypeState = DamageType.Frost;
                    }
                    if (state.Name == "Fire")
                    {
                        this.mCurrentDamageTypeState = DamageType.Fire;
                    }
                    if (state.Name == "Electric")
                    {
                        this.mCurrentDamageTypeState = DamageType.Electric;
                    }
                }
            }
            base.ApplyState(state);
        }
        private Gum.DataTypes.Variables.StateSave GetCurrentValuesOnState(ButtonCategory state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  ButtonCategory.Enabled:
                break;

            case  ButtonCategory.Disabled:
                break;

            case  ButtonCategory.Highlighted:
                break;

            case  ButtonCategory.Pushed:
                break;
            }
            return(newState);
        }
 public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateToRelative(RadioButtonCategory toState, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing, object owner = null)
 {
     Gum.DataTypes.Variables.StateSave           current       = GetCurrentValuesOnState(toState);
     Gum.DataTypes.Variables.StateSave           toAsStateSave = AddToCurrentValuesWithState(toState);
     FlatRedBall.Glue.StateInterpolation.Tweener tweener       = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing);
     if (owner == null)
     {
         tweener.Owner = this;
     }
     else
     {
         tweener.Owner = owner;
     }
     tweener.PositionChanged = newPosition => this.InterpolateBetween(current, toAsStateSave, newPosition);
     tweener.Ended          += () => this.CurrentRadioButtonCategoryState = toState;
     tweener.Start();
     StateInterpolationPlugin.TweenerManager.Self.Add(tweener);
     return(tweener);
 }
 public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateTo(VariableState toState, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing, object owner = null)
 {
     Gum.DataTypes.Variables.StateSave           current       = GetCurrentValuesOnState(toState);
     Gum.DataTypes.Variables.StateSave           toAsStateSave = this.ElementSave.States.First(item => item.Name == toState.ToString());
     FlatRedBall.Glue.StateInterpolation.Tweener tweener       = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing);
     if (owner == null)
     {
         tweener.Owner = this;
     }
     else
     {
         tweener.Owner = owner;
     }
     tweener.PositionChanged = newPosition => this.InterpolateBetween(current, toAsStateSave, newPosition);
     tweener.Ended          += () => this.CurrentVariableState = toState;
     tweener.Start();
     StateInterpolationPlugin.TweenerManager.Self.Add(tweener);
     return(tweener);
 }
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(ComboBoxCategory state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  ComboBoxCategory.Enabled:
                break;

            case  ComboBoxCategory.Disabled:
                break;

            case  ComboBoxCategory.Highlighted:
                break;

            case  ComboBoxCategory.Pushed:
                break;
            }
            return(newState);
        }
Esempio n. 25
0
 private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(VariableState state)
 {
     Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
     switch (state)
     {
     case  VariableState.Default:
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Height",
             Type      = "float",
             Value     = Height + 100f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Height Units",
             Type      = "DimensionUnitType",
             Value     = HeightUnits
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Width",
             Type      = "float",
             Value     = Width + 100f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Width Units",
             Type      = "DimensionUnitType",
             Value     = WidthUnits
         }
                                );
         break;
     }
     return(newState);
 }
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(VariableState state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  VariableState.Default:
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "PlayerSelectionUIInstance.ReadyToStartState",
                    Type      = "ReadyToStartState",
                    Value     = PlayerSelectionUIInstance.CurrentReadyToStartState
                }
                                       );
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "PlayerSelectionUIInstance.State",
                    Type      = "State",
                    Value     = PlayerSelectionUIInstance.CurrentVariableState
                }
                                       );
                newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
                {
                    SetsValue = true,
                    Name      = "PlayerSelectionUIInstance.VisibilityState",
                    Type      = "VisibilityState",
                    Value     = PlayerSelectionUIInstance.CurrentVisibilityState
                }
                                       );
                break;

            case  VariableState.PlayerSelection:
                break;

            case  VariableState.Game:
                break;
            }
            return(newState);
        }
Esempio n. 27
0
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                }
                else if (category.Name == "WindLevel")
                {
                    if (state.Name == "Level1")
                    {
                        this.mCurrentWindLevelState = WindLevel.Level1;
                    }
                    if (state.Name == "Level2")
                    {
                        this.mCurrentWindLevelState = WindLevel.Level2;
                    }
                    if (state.Name == "Level3")
                    {
                        this.mCurrentWindLevelState = WindLevel.Level3;
                    }
                    if (state.Name == "Level4")
                    {
                        this.mCurrentWindLevelState = WindLevel.Level4;
                    }
                }
            }
            base.ApplyState(state);
        }
Esempio n. 28
0
        public static void SetVariablesRecursively(this GraphicalUiElement graphicalElement, ElementSave elementSave, Gum.DataTypes.Variables.StateSave stateSave)
        {
            if (!string.IsNullOrEmpty(elementSave.BaseType))
            {
                var baseElementSave = Gum.Managers.ObjectFinder.Self.GetElementSave(elementSave.BaseType);
                if (baseElementSave != null)
                {
                    graphicalElement.SetVariablesRecursively(baseElementSave, baseElementSave.DefaultState);
                }
            }

            var variablesToSet = stateSave.Variables
                                 .Where(item => item.SetsValue && item.Value != null)
                                 // States should be applied first, then values may override states (order by sorts false first):
                                 .OrderBy(item => !item.IsState(elementSave))
                                 .ToList();

            foreach (var variable in variablesToSet)
            {
                // See below for explanation on why we don't set Parent here
                if (variable.GetRootName() != "Parent")
                {
                    graphicalElement.SetProperty(variable.Name, variable.Value);
                }
            }

            // Now set all parents
            // The reason for this is
            // because parents need to
            // be assigned in the order
            // of the instances in the .glux.
            // That way they are drawn in the same
            // order as they are defined.
            variablesToSet = variablesToSet.Where(item => item.GetRootName() == "Parent")
                             .OrderBy(item => elementSave.Instances.FindIndex(instance => instance.Name == item.SourceObject))
                             .ToList();

            foreach (var variable in variablesToSet)
            {
                graphicalElement.SetProperty(variable.Name, variable.Value);
            }
        }
Esempio n. 29
0
        // Replaced with ApplyDefaultState
        //static void SetVariablesRecursively(this GraphicalUiElement graphicalElement, ElementSave elementSave)
        //{
        //    graphicalElement.SetVariablesRecursively(elementSave, elementSave.DefaultState);
        //}

        public static void SetVariablesTopLevel(this GraphicalUiElement graphicalElement, ElementSave elementSave, Gum.DataTypes.Variables.StateSave stateSave)
        {
            foreach (var variable in stateSave.Variables.Where(item => item.SetsValue && item.Value != null))
            {
                graphicalElement.SetProperty(variable.Name, variable.Value);
            }
        }
Esempio n. 30
0
 private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(VariableState state)
 {
     Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
     switch (state)
     {
     case  VariableState.Default:
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Alpha",
             Type      = "int",
             Value     = Alpha + 255
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Animate",
             Type      = "bool",
             Value     = Animate
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Blue",
             Type      = "int",
             Value     = Blue + 255
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "FlipHorizontal",
             Type      = "bool",
             Value     = FlipHorizontal
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "FlipVertical",
             Type      = "bool",
             Value     = FlipVertical
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Green",
             Type      = "int",
             Value     = Green + 255
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Height",
             Type      = "float",
             Value     = Height + 100f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Height Units",
             Type      = "DimensionUnitType",
             Value     = HeightUnits
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Red",
             Type      = "int",
             Value     = Red + 255
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Rotation",
             Type      = "float",
             Value     = Rotation + 0f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "SourceFile",
             Type      = "string",
             Value     = SourceFile
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Texture Address",
             Type      = "TextureAddress",
             Value     = TextureAddress
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Texture Height",
             Type      = "int",
             Value     = TextureHeight + 0
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Texture Height Scale",
             Type      = "float",
             Value     = TextureHeightScale + 0f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Texture Left",
             Type      = "int",
             Value     = TextureLeft + 0
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Texture Top",
             Type      = "int",
             Value     = TextureTop + 0
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Texture Width",
             Type      = "int",
             Value     = TextureWidth + 0
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Texture Width Scale",
             Type      = "float",
             Value     = TextureWidthScale + 0f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Visible",
             Type      = "bool",
             Value     = Visible
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Width",
             Type      = "float",
             Value     = Width + 100f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Width Units",
             Type      = "DimensionUnitType",
             Value     = WidthUnits
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Wrap",
             Type      = "bool",
             Value     = Wrap
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "X",
             Type      = "float",
             Value     = X + 0f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "X Origin",
             Type      = "HorizontalAlignment",
             Value     = XOrigin
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "X Units",
             Type      = "PositionUnitType",
             Value     = XUnits
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Y",
             Type      = "float",
             Value     = Y + 0f
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Y Origin",
             Type      = "VerticalAlignment",
             Value     = YOrigin
         }
                                );
         newState.Variables.Add(new Gum.DataTypes.Variables.VariableSave()
         {
             SetsValue = true,
             Name      = "Y Units",
             Type      = "PositionUnitType",
             Value     = YUnits
         }
                                );
         break;
     }
     return(newState);
 }