Esempio n. 1
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            using (IEnumerator <Gizmo> enumerator = base.CompGetGizmosExtra().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo c = enumerator.Current;
                    yield return(c);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (base.parent.Faction != Faction.OfPlayer)
            {
                yield break;
            }
            yield return((Gizmo) new Command_Toggle
            {
                hotKey = KeyBindingDefOf.CommandTogglePower,
                icon = this.CommandTex,
                defaultLabel = this.Props.commandLabelKey.Translate(),
                defaultDesc = this.Props.commandDescKey.Translate(),
                isActive = (() => ((_003CCompGetGizmosExtra_003Ec__Iterator0) /*Error near IL_0145: stateMachine*/)._0024this.wantSwitchOn),
                toggleAction = delegate
                {
                    ((_003CCompGetGizmosExtra_003Ec__Iterator0) /*Error near IL_015c: stateMachine*/)._0024this.wantSwitchOn = !((_003CCompGetGizmosExtra_003Ec__Iterator0) /*Error near IL_015c: stateMachine*/)._0024this.wantSwitchOn;
                    FlickUtility.UpdateFlickDesignation(((_003CCompGetGizmosExtra_003Ec__Iterator0) /*Error near IL_015c: stateMachine*/)._0024this.parent);
                }
            });

            /*Error: Unable to find new state assignment for yield return*/;
IL_0196:
            /*Error near IL_0197: Unexpected return in MoveNext()*/;
        }
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     foreach (Gizmo item in base.CompGetGizmosExtra())
     {
         yield return(item);
     }
     if (parent.Faction == Faction.OfPlayer)
     {
         Command_Toggle command_Toggle = new Command_Toggle();
         command_Toggle.hotKey       = KeyBindingDefOf.Command_TogglePower;
         command_Toggle.icon         = CommandTex;
         command_Toggle.defaultLabel = Props.commandLabelKey.Translate();
         command_Toggle.defaultDesc  = Props.commandDescKey.Translate();
         command_Toggle.isActive     = () => wantSwitchOn;
         command_Toggle.toggleAction = delegate
         {
             wantSwitchOn = !wantSwitchOn;
             FlickUtility.UpdateFlickDesignation(parent);
         };
         yield return(command_Toggle);
     }
 }
Esempio n. 3
0
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     foreach (Gizmo c in base.CompGetGizmosExtra())
     {
         yield return(c);
     }
     if (this.parent.Faction == Faction.OfPlayer)
     {
         yield return(new Command_Toggle
         {
             hotKey = KeyBindingDefOf.CommandTogglePower,
             icon = this.CommandTex,
             defaultLabel = this.Props.commandLabelKey.Translate(),
             defaultDesc = this.Props.commandDescKey.Translate(),
             isActive = (() => this.$this.wantSwitchOn),
             toggleAction = delegate
             {
                 this.$this.wantSwitchOn = !this.$this.wantSwitchOn;
                 FlickUtility.UpdateFlickDesignation(this.$this.parent);
             }
         });
     }
 }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    enumerator = base.< CompGetGizmosExtra > __BaseCallProxy0().GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_193;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        c             = enumerator.Current;
                        this.$current = c;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                if (this.parent.Faction != Faction.OfPlayer)
                {
                    goto IL_193;
                }
                Command_Toggle com = new Command_Toggle();

                com.hotKey       = KeyBindingDefOf.Command_TogglePower;
                com.icon         = base.CommandTex;
                com.defaultLabel = base.Props.commandLabelKey.Translate();
                com.defaultDesc  = base.Props.commandDescKey.Translate();
                com.isActive     = (() => this.wantSwitchOn);
                com.toggleAction = delegate()
                {
                    this.wantSwitchOn = !this.wantSwitchOn;
                    FlickUtility.UpdateFlickDesignation(this.parent);
                };
                this.$current = com;
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);

IL_193:
                this.$PC = -1;
                return(false);
            }