Inheritance: MonoBehaviour
Example #1
0
 public void resetGizmo()
 {
     removeGizmo();
     gameObject.layer = 2;
     foreach (Transform child in transform) {
         child.gameObject.layer = 2;
     }
     gizmoObj = (GameObject) Instantiate(gizmoAxis, transform.position, transform.rotation);
     gizmoObj.transform.localScale *= gizmoSize;
     gizmo = (Gizmo) gizmoObj.GetComponent("Gizmo");
     gizmo.setParent(transform);
     gizmo.setType(gizmoType);
 }
Example #2
0
 public void ResetGizmo()
 {
     RemoveGizmo();
     gameObject.layer = 2;
     foreach (Transform child in transform)
     {
         child.gameObject.layer = 2;
     }
     gizmoObj = AssetsManager.Instantiate(Resources.Load("3D/Gizmo/GizmoAxis"), transform.position, transform.rotation);
     gizmoObj.transform.localScale *= gizmoSize;
     gizmo = gizmoObj.GetComponent<Gizmo>();
     gizmo.setParent(transform);
     gizmo.setType(gizmoType);
 }
Example #3
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo c = enumerator.Current;
                    yield return(c);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(def.entityDefToBuild, base.Stuff);

            if (buildCopy != null)
            {
                yield return((Gizmo)buildCopy);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (base.Faction == Faction.OfPlayer)
            {
                using (IEnumerator <Command> enumerator2 = BuildFacilityCommandUtility.BuildFacilityCommands(def.entityDefToBuild).GetEnumerator())
                {
                    if (enumerator2.MoveNext())
                    {
                        Command facility = enumerator2.Current;
                        yield return((Gizmo)facility);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
            }
            yield break;
IL_01be:
            /*Error near IL_01bf: Unexpected return in MoveNext()*/;
        }
Example #4
0
        public static void Draw(SpriteBatch spriteBatch)
        {
            List <GameObject> visibleObjects;

            if (useQuadTree)
            {
                foreach (GameObject go in alwaysUpdated)
                {
                    go.Draw(spriteBatch);
                }
                visibleObjects = gameObjectTree.QueryRange(Camera.Main.VisibleAreaAABB);
                foreach (GameObject visibleObject in visibleObjects)
                {
                    if (visibleObject.IsVisible(Camera.Main))
                    {
                        visibleObject.Draw(spriteBatch);
                    }
                }
            }
            else
            {
                visibleObjects = gameObjects.Where(gameObject => gameObject.IsVisible(Camera.Main)).ToList();
                foreach (GameObject visibleObject in visibleObjects)
                {
                    visibleObject.Draw(spriteBatch);
                }
            }
            if (Settings.DEBUG_GAME_OBJECTS)
            {
                Gizmo.Text(
                    $"Visible objects: {visibleObjects.Count}",
                    Camera.Main.ToWorldCoordinates(new Vector2(0, 40)), Color.White);
                Gizmo.Text(
                    $"All objects: {gameObjects.Count}",
                    Camera.Main.ToWorldCoordinates(new Vector2(0, 58)), Color.White);
            }
        }
Example #5
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo g = enumerator.Current;
                    yield return(g);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (HasMap)
            {
                yield return((Gizmo) new Command_Action
                {
                    defaultLabel = "CommandShowMap".Translate(),
                    defaultDesc = "CommandShowMapDesc".Translate(),
                    icon = ShowMapCommand,
                    hotKey = KeyBindingDefOf.Misc1,
                    action = delegate
                    {
                        Current.Game.CurrentMap = ((_003CGetGizmos_003Ec__Iterator1) /*Error near IL_011f: stateMachine*/)._0024this.Map;
                        if (!CameraJumper.TryHideWorld())
                        {
                            SoundDefOf.TabClose.PlayOneShotOnCamera();
                        }
                    }
                });

                /*Error: Unable to find new state assignment for yield return*/;
            }
            yield break;
IL_0159:
            /*Error near IL_015a: Unexpected return in MoveNext()*/;
        }
			public bool MoveNext()
			{
				uint num = (uint)this.$PC;
				this.$PC = -1;
				switch (num)
				{
				case 0u:
					com = new Command_Toggle();
					com.hotKey = KeyBindingDefOf.Command_TogglePower;
					com.defaultLabel = "CommandGatherSpotToggleLabel".Translate();
					com.icon = TexCommand.GatherSpotActive;
					com.isActive = new Func<bool>(base.get_Active);
					com.toggleAction = delegate()
					{
						base.Active = !base.Active;
					};
					if (base.Active)
					{
						com.defaultDesc = "CommandGatherSpotToggleDescActive".Translate();
					}
					else
					{
						com.defaultDesc = "CommandGatherSpotToggleDescInactive".Translate();
					}
					this.$current = com;
					if (!this.$disposing)
					{
						this.$PC = 1;
					}
					return true;
				case 1u:
					this.$PC = -1;
					break;
				}
				return false;
			}
Example #7
0
        public static void SetAsSelected(Node node, Gizmo gizmo, PulsarScene scene)
        {
            StaticModel nodeModel = node.GetComponent <StaticModel>();

            if (nodeModel != null)
            {
                MaterialTemp tempMaterial = new MaterialTemp(nodeModel, scene.GetApplication());
                if (tempMaterial != null)
                {
                    tempMaterial.Name = "materialTemp";
                    tempMaterial.SetTransparentMaterial();

                    node.AddComponent(tempMaterial);
                    if (gizmo != null)
                    {
                        gizmo.Node.Position = node.Position;
                        Debug.Print("GizmoHelper.SetAsSelected - Calling gizmo.SetGizmoVisible with value true for gizmo '" + gizmo.Name);
                        gizmo.SetGizmoVisible(true);
                        Debug.Print("GizmoHelper.SetAsSelected - Setting gizmo.Node.Enabled to true for gizmo '" + gizmo.Name);
                        gizmo.Node.Enabled = true;
                    }
                }
            }
        }
Example #8
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Gizmo current = enumerator.Current;
                yield return(current);
            }

            if (!this.Map.listerThings.AllThings.Any(x => x is ShipBase || x is ShipBase_Traveling))
            {
                Command_Action command_Action = new Command_Action();
                command_Action.defaultLabel = "CommandRemoveDropsite".Translate();
                command_Action.defaultDesc  = "CommandRemoveDropsiteDesc".Translate();
                command_Action.icon         = DropShipUtility.CancelTex;
                command_Action.action       = delegate
                {
                    SoundDef.Named("ShipTakeoff_SuborbitalLaunch").PlayOneShotOnCamera();
                    this.forcedRemoval = true;
                };
                yield return(command_Action);
            }
        }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo c = enumerator.Current;
                    yield return(c);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(base.def.entityDefToBuild, this.stuffToUse);

            if (buildCopy == null)
            {
                yield break;
            }
            yield return((Gizmo)buildCopy);

            /*Error: Unable to find new state assignment for yield return*/;
IL_010e:
            /*Error near IL_010f: Unexpected return in MoveNext()*/;
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    if (Prefs.DevMode)
                    {
                        Command_Action com = new Command_Action();
                        com.defaultLabel = "DEBUG: Spawn " + base.PropsSpawner.thingToSpawn.label;
                        com.icon         = TexCommand.DesirePower;
                        com.action       = delegate()
                        {
                            base.TryDoSpawn();
                            base.ResetCountdown();
                        };
                        this.$current = com;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        return(true);
                    }
                    break;

                case 1u:
                    break;

                default:
                    return(false);
                }
                this.$PC = -1;
                return(false);
            }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Gizmo current = enumerator.Current;
                yield return(current);
            }
            if (Prefs.DevMode)
            {
                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: Spawn pawn",
                    icon = TexCommand.ReleaseAnimals,
                    action = delegate
                    {
                        Pawn pawn;
                        this.TrySpawnPawn(out pawn, Map);
                    }
                });
            }
            yield break;
        }
Example #12
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Gizmo current = enumerator.Current;
                yield return(current);
            }

            yield return(new Command_Action
            {
                defaultLabel = "Discard",
                icon = ContentFinder <Texture2D> .Get("UI/Commands/Detonate", true),
                defaultDesc = "Disposes of unwanted journal pages.",
                action = delegate
                {
                    this.DeSpawn();
                },
                hotKey = KeyBindingDefOf.Misc3
            });

            yield break;
        }
Example #13
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Gizmo current = enumerator.Current;
                yield return(current);
            }

            Command_Toggle toggleDef = new Command_Toggle();

            toggleDef.hotKey = KeyBindingDefOf.Command_TogglePower;
            toggleDef.icon   = ContentFinder <Texture2D> .Get("UI/Icons/Commands/Mute", true);

            toggleDef.defaultLabel = "Mute".Translate();
            toggleDef.defaultDesc  = "MuteDesc".Translate();
            toggleDef.isActive     = (() => this.isMuted);
            toggleDef.toggleAction = delegate
            {
                MuteToggle();
            };
            yield return(toggleDef);
        }
 public void Weak_reference_cannot_be_resolved()
 {
     var g = new Gizmo
     {
         Id = "gx",
         Name = "weeeeaaaak",
         Primary = Reference.To<Widget>("w6"),
     };
     Assert.Throws<InvalidOperationException>(() => { var x = g.Primary.Value; });
 }
Example #15
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            IEnumerator <Gizmo> enumerator = base.CompGetGizmosExtra().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Gizmo current = enumerator.Current;
                yield return(current);
            }
            //Log.Message("0");
            if (this.Pawn.Faction == Faction.OfPlayerSilentFail)
            {
                //Log.Message("1");
                if (this.Props.roles != null && this.Props.roles.Count > 0)
                {
                    //Log.Message("2");
                    foreach (VehicleHandlerGroup group in this.handlers)
                    {
                        //Log.Message("3");
                        if (group.role != null && group.handlers != null)
                        {
                            //Log.Message("4");
                            bool loadable   = group.AreSlotsAvailable;
                            bool unloadable = group.handlers.Count > 0;
                            if (loadable || unloadable)
                            {
                                //Log.Message("5");
                                Command_VehicleHandler button = new Command_VehicleHandler()
                                {
                                    action = delegate
                                    {
                                        SoundDefOf.TickTiny.PlayOneShotOnCamera(null);
                                        GetVehicleButtonFloatMenu(group, loadable);
                                    },
                                    hotKey = KeyBindingDefOf.Misc1
                                };
                                string label = "CompVehicle_Load";
                                string desc  = "CompVehicle_LoadDesc";
                                if (!loadable && unloadable)
                                {
                                    label = "CompVehicle_Unload";
                                    desc  = "CompVehicle_UnloadDesc";
                                }
                                if (loadable && unloadable)
                                {
                                    label = "CompVehicle_LoadUnload";
                                    desc  = "CompVehicle_LoadUnloadDesc";
                                }

                                button.defaultLabel = label.Translate(group.role.label.CapitalizeFirst());
                                button.defaultDesc  = desc.Translate(group.role.label.CapitalizeFirst());
                                button.icon         = TexCommand.Install; //ContentFinder<Texture2D>.Get("UI/Commands/TryReconnect", true);

                                button.disabled       = this.Pawn.Downed || this.Pawn.Dead;
                                button.disabledReason = "CompVehicle_DisabledDesc".Translate();

                                //Log.Message(button.ToString());
                                yield return(button);
                            }
                        }
                    }
                }
                if (this.Pawn.drafter == null)
                {
                    this.Pawn.drafter = new Pawn_DraftController(this.Pawn);
                }
            }
        }
Example #16
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

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

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

                case 1u:
                    break;

                case 2u:
                    this.$PC = -1;
                    return(false);

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        g             = enumerator.Current;
                        this.$current = g;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                Command_Action remove = new Command_Action();

                remove.defaultLabel = "CommandRemoveWaypointLabel".Translate();
                remove.defaultDesc  = "CommandRemoveWaypointDesc".Translate();
                remove.icon         = TexCommand.RemoveRoutePlannerWaypoint;
                remove.action       = delegate()
                {
                    Find.WorldRoutePlanner.TryRemoveWaypoint(this, true);
                };
                this.$current = remove;
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);
            }
Example #17
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (Gizmo gizmo in base.CompGetGizmosExtra())
            {
                Gizmo g = gizmo;
                yield return(g);

                g = null;
            }
            if (this.LoadingInProgressOrReadyToLaunch)
            {
                Command_Action launch = new Command_Action();
                launch.defaultLabel = "CommandLaunchGroup".Translate();
                launch.defaultDesc  = "CommandLaunchGroupDesc".Translate();
                launch.icon         = LaunchCommandTex;
                launch.alsoClickIfOtherInGroupClicked = false;
                launch.action = (Action)(() =>
                {
                    int num = 0;
                    foreach (Thing t in this.Transporter.innerContainer)
                    {
                        if (t is Pawn && (t as Pawn).IsColonist)
                        {
                            num++;
                        }
                    }
                    if (SRTSMod.mod.settings.passengerLimits)
                    {
                        if (num < SRTSMod.GetStatFor <int>(this.parent.def.defName, StatName.minPassengers))
                        {
                            Messages.Message("NotEnoughPilots".Translate(), MessageTypeDefOf.RejectInput, false);
                            return;
                        }
                        else if (num > SRTSMod.GetStatFor <int>(this.parent.def.defName, StatName.maxPassengers))
                        {
                            Messages.Message("TooManyPilots".Translate(), MessageTypeDefOf.RejectInput, false);
                            return;
                        }
                    }

                    if (this.AnyInGroupHasAnythingLeftToLoad)
                    {
                        Find.WindowStack.Add((Window)Dialog_MessageBox.CreateConfirmation("ConfirmSendNotCompletelyLoadedPods".Translate(this.FirstThingLeftToLoadInGroup.LabelCapNoCount), new Action(this.StartChoosingDestination), false, (string)null));
                    }
                    else
                    {
                        this.StartChoosingDestination();
                    }
                });
                if (!this.AllInGroupConnectedToFuelingPort)
                {
                    launch.Disable("CommandLaunchGroupFailNotConnectedToFuelingPort".Translate());
                }
                else if (!this.AllFuelingPortSourcesInGroupHaveAnyFuel)
                {
                    launch.Disable("CommandLaunchGroupFailNoFuel".Translate());
                }
                else if (this.AnyInGroupIsUnderRoof && !this.parent.Position.GetThingList(this.parent.Map).Any(x => x.def.defName == "ShipShuttleBay"))
                {
                    launch.Disable("CommandLaunchGroupFailUnderRoof".Translate());
                }
                yield return(launch);
            }
        }
        public override void MergeWith(Gizmo other)
        {
            return;

            base.MergeWith(other);
        }
Example #19
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Gizmo current = enumerator.Current;
                yield return(current);
            }
            if (this.Faction == Faction.OfPlayer)
            {
                if (this.ReadyForTakeoff)
                {
                    Command_Action command_Action = new Command_Action();
                    command_Action.defaultLabel = "CommandLaunchShip".Translate();
                    command_Action.defaultDesc  = "CommandLaunchShipDesc".Translate();
                    command_Action.icon         = DropShipUtility.LaunchSingleCommandTex;
                    command_Action.action       = delegate
                    {
                        SoundDef.Named("ShipTakeoff_SuborbitalLaunch").PlayOneShotOnCamera();
                        this.LaunchAsFleet = false;
                        this.StartChoosingDestination(this, this.LaunchAsFleet);
                    };
                    yield return(command_Action);

                    if (this.fleetID != -1)
                    {
                        Command_Action command_Action3 = new Command_Action();
                        command_Action3.defaultLabel = "CommandLaunchFleet".Translate();
                        command_Action3.defaultDesc  = "CommandLaunchFleetDesc".Translate();
                        command_Action3.icon         = DropShipUtility.LaunchFleetCommandTex;
                        command_Action3.action       = delegate
                        {
                            SoundDef.Named("ShipTakeoff_SuborbitalLaunch").PlayOneShotOnCamera();
                            this.LaunchAsFleet = true;
                            this.StartChoosingDestination(this, this.LaunchAsFleet);
                        };
                        if (DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(x => !x.ReadyForTakeoff))
                        {
                            command_Action3.Disable("CommandLaunchFleetFailDueToNotReady".Translate());
                        }

                        yield return(command_Action3);


                        if (this.ParkingMap != null && !DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID).Any(x => x.ParkingMap != null || !x.ReadyForTakeoff))
                        {
                            Command_Action command_Action5 = new Command_Action();
                            command_Action5.defaultLabel = "CommandTravelParkingPositionFleet".Translate();
                            command_Action5.defaultDesc  = "CommandTravelParkingPositionFleetDesc".Translate();
                            command_Action5.icon         = DropShipUtility.ReturnParkingFleet;
                            command_Action5.action       = delegate
                            {
                                foreach (ShipBase ship in DropShipUtility.currentShipTracker.ShipsInFleet(this.fleetID))
                                {
                                    ship.TryLaunch(new GlobalTargetInfo(ship.ParkingPosition, ship.ParkingMap), PawnsArriveMode.CenterDrop, TravelingShipArrivalAction.EnterMapFriendly, false);
                                }
                            };
                            yield return(command_Action5);
                        }
                    }
                }
                {
                    Command_Action command_Action2 = new Command_Action();
                    command_Action2.defaultLabel = "CommandLoadShipCargo".Translate();
                    command_Action2.defaultDesc  = "CommandLoadShipCargoDesc".Translate();
                    command_Action2.icon         = DropShipUtility.LoadCommandTex;
                    command_Action2.action       = delegate
                    {
                        Find.WindowStack.Add(new Dialog_LoadShipCargo(this.Map, this));
                    };
                    yield return(command_Action2);
                }
                {
                    Command_Action command_Action3 = new Command_Action();
                    command_Action3.defaultLabel = "CommandSetParkingPosition".Translate();
                    command_Action3.defaultDesc  = "CommandSetParkingPositionDesc".Translate();
                    command_Action3.icon         = DropShipUtility.ParkingSingle;
                    command_Action3.action       = delegate
                    {
                        this.ParkingMap      = this.Map;
                        this.ParkingPosition = this.Position;
                    };
                    yield return(command_Action3);
                }
                if (this.ParkingMap != null && this.ReadyForTakeoff)
                {
                    this.LaunchAsFleet = true;
                    Command_Action command_Action4 = new Command_Action();
                    command_Action4.defaultLabel = "CommandTravelParkingPosition".Translate();
                    command_Action4.defaultDesc  = "CommandTravelParkingPositionDesc".Translate();
                    command_Action4.icon         = DropShipUtility.ReturnParkingSingle;
                    command_Action4.action       = delegate
                    {
                        this.TryLaunch(new GlobalTargetInfo(this.ParkingPosition, this.ParkingMap), PawnsArriveMode.CenterDrop, TravelingShipArrivalAction.EnterMapFriendly, false);
                    };
                    yield return(command_Action4);
                }
            }
        }
 public void Strong_reference_value_must_have_id_before_save()
 {
     var r = new Repository<Gizmo>(_sx);
     var g5 = new Gizmo
     {
         Id = "g5",
         Name = "stronglikewho?",
         Primary = Reference.To(new Widget { Name = "name, but no id" }),
     };
     Assert.Throws<InvalidOperationException>(() => r.Save(g5));
 }
            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_1CB;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        g             = enumerator.Current;
                        this.$current = g;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                if (!base.LoadingInProgressOrReadyToLaunch)
                {
                    goto IL_1CB;
                }
                launch = new Command_Action();
                launch.defaultLabel = "CommandLaunchGroup".Translate();
                launch.defaultDesc  = "CommandLaunchGroupDesc".Translate();
                launch.icon         = CompLaunchable.LaunchCommandTex;
                launch.alsoClickIfOtherInGroupClicked = false;
                launch.action = delegate()
                {
                    if (base.AnyInGroupHasAnythingLeftToLoad)
                    {
                        Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSendNotCompletelyLoadedPods".Translate(new object[]
                        {
                            base.FirstThingLeftToLoadInGroup.LabelCapNoCount
                        }), new Action(base.StartChoosingDestination), false, null));
                    }
                    else
                    {
                        base.StartChoosingDestination();
                    }
                };
                if (!base.AllInGroupConnectedToFuelingPort)
                {
                    launch.Disable("CommandLaunchGroupFailNotConnectedToFuelingPort".Translate());
                }
                else if (!base.AllFuelingPortSourcesInGroupHaveAnyFuel)
                {
                    launch.Disable("CommandLaunchGroupFailNoFuel".Translate());
                }
                else if (base.AnyInGroupIsUnderRoof)
                {
                    launch.Disable("CommandLaunchGroupFailUnderRoof".Translate());
                }
                this.$current = launch;
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);

IL_1CB:
                this.$PC = -1;
                return(false);
            }
        /*
         * public static Gizmo DrawWireMesh(Mesh mesh,
         *  int submeshIndex = 0,
         *  Vector3 position = default,
         *  Quaternion rotation = default,
         *  Vector3 scale = default)
         *  => Draw(new Gizmo(() => Gizmos.DrawWireMesh(mesh, submeshIndex, position, rotation, scale)));
         */


        /*
         * public static Gizmo[] DrawArrow(Vector3 origin, Vector3 direction)
         * {
         *  //=> Draw(new Gizmo())
         *  float headSize = 0.1f;
         *  Vector3 end = origin + direction;
         *  Vector3 arrowBase = origin + direction * (1 - headSize);
         *  Vector3 left = Vector3.Cross(direction, Vector3.up).normalized;
         *  Vector3 up = Vector3.Cross(left, direction).normalized;
         *
         *  //Gizmos.DrawLine(origin, origin + direction);
         *  // 4 Arrowhead sides
         *  //Gizmos.DrawLine(end, arrowBase + left * headSize);
         *  //Gizmos.DrawLine(end, arrowBase + up * headSize);
         *  //Gizmos.DrawLine(end, arrowBase - left * headSize);
         *  //Gizmos.DrawLine(end, arrowBase - up * headSize);
         *  // 2 Arrowhed bases
         *  //Gizmos.DrawLine(arrowBase + left * headSize, arrowBase - left * headSize);
         *  //Gizmos.DrawLine(arrowBase + up * headSize, arrowBase - up * headSize);
         *
         *
         *  //TODO: EDIT
         *  return Draw
         *  (
         *      new Gizmo(() => Gizmos.DrawLine(origin, origin + direction)),
         *      new Gizmo(() => Gizmos.DrawLine(end, arrowBase + left * headSize)),
         *      new Gizmo(() => Gizmos.DrawLine(end, arrowBase + up * headSize)),
         *      new Gizmo(() => Gizmos.DrawLine(end, arrowBase - left * headSize)),
         *      new Gizmo(() => Gizmos.DrawLine(end, arrowBase - up * headSize)),
         *      new Gizmo(() => Gizmos.DrawLine(arrowBase + left * headSize, arrowBase - left * headSize)),
         *      new Gizmo( () => Gizmos.DrawLine(arrowBase + up * headSize, arrowBase - up * headSize))
         *  );
         * }
         */

        private static Gizmo Draw(Gizmo gizmo)
        {
            GizmoDrawer.Draw(gizmo);
            return(gizmo);
        }
 public void Strong_reference_can_be_written()
 {
     {
         var r = new Repository<Gizmo>(_sx);
         var rw = new Repository<Widget>(_sx);
         var w5 = rw.Get("w5");
         var g4 = new Gizmo
         {
             Id = "g4",
             Name = "stronglikeukraine",
             Primary = Reference.To(w5),
         };
         Assert.DoesNotThrow(() => r.Save(g4));
     }
     {
         var r = new Repository<Gizmo>(_sx2);
         var g4 = r.Get("g4");
         Assert.That(g4.Primary.Value.Cost, Is.EqualTo(45));
     }
 }
        // Token: 0x06001B69 RID: 7017 RVA: 0x000A8ABC File Offset: 0x000A6CBC
        public override bool InheritInteractionsFrom(Gizmo other)
        {
            Command_ToggleOgsOld_CompTurret command_Toggle = other as Command_ToggleOgsOld_CompTurret;

            return(command_Toggle != null && command_Toggle.isActive() == this.isActive());
        }
Example #25
0
 public static void DrawInspectGizmoGridFor(IEnumerable <object> selectedObjects, out Gizmo mouseoverGizmo)
 {
     mouseoverGizmo = null;
     try
     {
         InspectGizmoGrid.objList.Clear();
         InspectGizmoGrid.objList.AddRange(selectedObjects);
         InspectGizmoGrid.gizmoList.Clear();
         for (int i = 0; i < InspectGizmoGrid.objList.Count; i++)
         {
             ISelectable selectable = InspectGizmoGrid.objList[i] as ISelectable;
             if (selectable != null)
             {
                 InspectGizmoGrid.gizmoList.AddRange(selectable.GetGizmos());
             }
         }
         for (int j = 0; j < InspectGizmoGrid.objList.Count; j++)
         {
             Thing t = InspectGizmoGrid.objList[j] as Thing;
             if (t != null)
             {
                 List <Designator> allDesignators = Find.ReverseDesignatorDatabase.AllDesignators;
                 for (int k = 0; k < allDesignators.Count; k++)
                 {
                     Designator des = allDesignators[k];
                     if (des.CanDesignateThing(t).Accepted)
                     {
                         Command_Action command_Action = new Command_Action();
                         command_Action.defaultLabel = des.LabelCapReverseDesignating(t);
                         float   iconAngle;
                         Vector2 iconOffset;
                         command_Action.icon        = des.IconReverseDesignating(t, out iconAngle, out iconOffset);
                         command_Action.iconAngle   = iconAngle;
                         command_Action.iconOffset  = iconOffset;
                         command_Action.defaultDesc = des.DescReverseDesignating(t);
                         command_Action.order       = ((!(des is Designator_Uninstall)) ? -20f : -11f);
                         command_Action.action      = delegate
                         {
                             if (!TutorSystem.AllowAction(des.TutorTagDesignate))
                             {
                                 return;
                             }
                             des.DesignateThing(t);
                             des.Finalize(true);
                         };
                         command_Action.hotKey   = des.hotKey;
                         command_Action.groupKey = des.groupKey;
                         InspectGizmoGrid.gizmoList.Add(command_Action);
                     }
                 }
             }
         }
         InspectGizmoGrid.objList.Clear();
         GizmoGridDrawer.DrawGizmoGrid(InspectGizmoGrid.gizmoList, InspectPaneUtility.PaneWidthFor(Find.WindowStack.WindowOfType <IInspectPane>()) + 20f, out mouseoverGizmo);
         InspectGizmoGrid.gizmoList.Clear();
     }
     catch (Exception ex)
     {
         Log.ErrorOnce(ex.ToString(), 3427734, false);
     }
 }
 // Token: 0x06005675 RID: 22133 RVA: 0x001CE734 File Offset: 0x001CC934
 public override bool GroupsWith(Gizmo other)
 {
     return(false);
 }
Example #27
0
 public override bool GroupsWith(Gizmo other) => false;
        public static void Detour(IEnumerable <object> selectedObjects, ref Gizmo mouseoverGizmo)
        {
            var DoRebuild = !(Analyzer.Settings.OptimizeDrawInspectGizmoGrid && Event.current.type != EventType.Repaint);

            Profiler prof = null;

            if (DoRebuild)
            {
                mouseoverGizmo = null;
                try
                {
                    InspectGizmoGrid.objList.Clear();
                    InspectGizmoGrid.objList.AddRange(selectedObjects);
                    InspectGizmoGrid.gizmoList.Clear();
                    var slam = InspectGizmoGrid.objList.Count;
                    for (var i = 0; i < slam; i++)
                    {
                        if (InspectGizmoGrid.objList[i] is ISelectable selectable)
                        {
                            if (Active)
                            {
                                var me = string.Intern($"{selectable.GetType()} Gizmos");
                                prof = Analyzer.Start(me);
                                InspectGizmoGrid.gizmoList.AddRange(selectable.GetGizmos());
                                prof.Stop();
                            }
                            else
                            {
                                InspectGizmoGrid.gizmoList.AddRange(selectable.GetGizmos());
                            }
                        }
                    }
                    for (var j = 0; j < InspectGizmoGrid.objList.Count; j++)
                    {
                        if (InspectGizmoGrid.objList[j] is Thing t)
                        {
                            var allDesignators = Find.ReverseDesignatorDatabase.AllDesignators;
                            var coo            = allDesignators.Count;
                            for (var k = 0; k < coo; k++)
                            {
                                Designator des = allDesignators[k];
                                if (des.CanDesignateThing(t).Accepted)
                                {
                                    var command_Action = new Command_Action
                                    {
                                        defaultLabel = des.LabelCapReverseDesignating(t),
                                        icon         = des.IconReverseDesignating(t, out var iconAngle, out var iconOffset),
                                        iconAngle    = iconAngle,
                                        iconOffset   = iconOffset,
                                        defaultDesc  = des.DescReverseDesignating(t),
                                        order        = (!(des is Designator_Uninstall) ? -20f : -11f),
                                        action       = delegate
                                        {
                                            if (!TutorSystem.AllowAction(des.TutorTagDesignate))
                                            {
                                                return;
                                            }

                                            des.DesignateThing(t);
                                            des.Finalize(true);
                                        },
                                        hotKey   = des.hotKey,
                                        groupKey = des.groupKey
                                    };
                                    InspectGizmoGrid.gizmoList.Add(command_Action);
                                }
                            }
                        }
                    }
                    InspectGizmoGrid.objList.Clear();
                }
                catch (Exception ex)
                {
                    Log.ErrorOnce(ex.ToString(), 3427734);
                }
            }

            if (Active)
            {
                prof = Analyzer.Start(str);
            }
            GizmoGridDrawer.DrawGizmoGrid(InspectGizmoGrid.gizmoList, InspectPaneUtility.PaneWidthFor(Find.WindowStack.WindowOfType <IInspectPane>()) + 20f, out mouseoverGizmo);
            if (Active)
            {
                prof.Stop();
            }
        }
 // determine conditions of hiding similar gizmos
 public override bool GroupsWith(Gizmo other)
 {
     return false;
 }
Example #30
0
 public void RemoveObserveGizmo(Gizmo gizmo)
 {
     observeGizmos.Remove(gizmo);
 }
Example #31
0
			static public void AddGizmo (string channel, Gizmo gizmo) 
			{ 
				if (gizmo.color.r==0 && gizmo.color.g==0 && gizmo.color.b==0 && gizmo.color.a==0) gizmo.color = Color.green;
				channels[FindChannel(channel)].AddGizmo(gizmo); 
			}
Example #32
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            using (IEnumerator <Gizmo> enumerator = base.CompGetGizmosExtra().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo g = enumerator.Current;
                    yield return(g);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (!LoadingInProgressOrReadyToLaunch)
            {
                Command_LoadToTransporter loadGroup = new Command_LoadToTransporter();
                int selectedTransportersCount       = 0;
                for (int i = 0; i < Find.Selector.NumSelected; i++)
                {
                    Thing thing = Find.Selector.SelectedObjectsListForReading[i] as Thing;
                    if (thing != null && thing.def == parent.def)
                    {
                        CompLaunchable compLaunchable = thing.TryGetComp <CompLaunchable>();
                        if (compLaunchable == null || (compLaunchable.FuelingPortSource != null && compLaunchable.FuelingPortSourceHasAnyFuel))
                        {
                            selectedTransportersCount++;
                        }
                    }
                }
                loadGroup.defaultLabel = "CommandLoadTransporter".Translate(selectedTransportersCount.ToString());
                loadGroup.defaultDesc  = "CommandLoadTransporterDesc".Translate();
                loadGroup.icon         = LoadCommandTex;
                loadGroup.transComp    = this;
                CompLaunchable launchable = Launchable;
                if (launchable != null)
                {
                    if (!launchable.ConnectedToFuelingPort)
                    {
                        loadGroup.Disable("CommandLoadTransporterFailNotConnectedToFuelingPort".Translate());
                    }
                    else if (!launchable.FuelingPortSourceHasAnyFuel)
                    {
                        loadGroup.Disable("CommandLoadTransporterFailNoFuel".Translate());
                    }
                }
                yield return((Gizmo)loadGroup);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            yield return((Gizmo) new Command_Action
            {
                defaultLabel = "CommandCancelLoad".Translate(),
                defaultDesc = "CommandCancelLoadDesc".Translate(),
                icon = CancelLoadCommandTex,
                action = delegate
                {
                    SoundDefOf.Designate_Cancel.PlayOneShotOnCamera();
                    ((_003CCompGetGizmosExtra_003Ec__Iterator0) /*Error near IL_011f: stateMachine*/)._0024this.CancelLoad();
                }
            });

            /*Error: Unable to find new state assignment for yield return*/;
IL_0457:
            /*Error near IL_0458: Unexpected return in MoveNext()*/;
        }
Example #33
0
 // Use this for initialization
 void Start()
 {
     gizmoControl = GameObject.Find("Gizmo").GetComponent<Gizmo>();
 }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

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

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

                case 1u:
                    break;

                case 2u:
                {
                    Command_Toggle com = new Command_Toggle();
                    com.defaultLabel = "CommandAllowSow".Translate();
                    com.defaultDesc  = "CommandAllowSowDesc".Translate();
                    com.hotKey       = KeyBindingDefOf.Command_ItemForbid;
                    com.icon         = TexCommand.Forbidden;
                    com.isActive     = (() => this.allowSow);
                    com.toggleAction = delegate()
                    {
                        this.allowSow = !this.allowSow;
                    };
                    this.$current = com;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);
                }

                case 3u:
                    this.$PC = -1;
                    return(false);

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        g             = enumerator.Current;
                        this.$current = g;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                this.$current = PlantToGrowSettableUtility.SetPlantToGrowCommand(this);
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);
            }
Example #35
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

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

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

                case 1u:
                    break;

                case 2u:
                    goto IL_155;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        g             = enumerator.Current;
                        this.$current = g;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                if (DesignatorUtility.FindAllowedDesignator <Designator_ZoneAddStockpile_Resources>() == null)
                {
                    goto IL_155;
                }
                Command_Action mz = new Command_Action();

                mz.action      = new Action(base.MakeMatchingStockpile);
                mz.hotKey      = KeyBindingDefOf.Misc1;
                mz.defaultDesc = "CommandMakeBeaconStockpileDesc".Translate();
                mz.icon        = ContentFinder <Texture2D> .Get("UI/Designators/ZoneCreate_Stockpile", true);

                mz.defaultLabel = "CommandMakeBeaconStockpileLabel".Translate();
                this.$current   = mz;
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);

IL_155:
                this.$PC = -1;
                return(false);
            }
 // can't stack with other gizmoes
 public override bool GroupsWith(Gizmo other) => false;
Example #37
0
 public override bool InheritFloatMenuInteractionsFrom(Gizmo other)
 {
     // activate context menu items only for one selected pawn
     return(false);
 }
Example #38
0
				public void AddGizmo (Gizmo gizmo)
				{
					if (gizmoCount==gizmos.Length) System.Array.Resize(ref gizmos, gizmos.Length*2);
					gizmos[gizmoCount] = gizmo;
					gizmoCount++;
				}
Example #39
0
            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_176;

                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.connectParent == null || this.parent.Faction != Faction.OfPlayer)
                {
                    goto IL_176;
                }
                Command_Action rec = new Command_Action();

                rec.action = delegate()
                {
                    SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null);
                    base.TryManualReconnect();
                };
                rec.hotKey      = KeyBindingDefOf.Misc1;
                rec.defaultDesc = "CommandTryReconnectDesc".Translate();
                rec.icon        = ContentFinder <Texture2D> .Get("UI/Commands/TryReconnect", true);

                rec.defaultLabel = "CommandTryReconnectLabel".Translate();
                this.$current    = rec;
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);

IL_176:
                this.$PC = -1;
                return(false);
            }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

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

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

                case 1u:
                    break;

                case 2u:
                    this.$PC = -1;
                    return(false);

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

                com.defaultLabel = "CommandAutoRearm".Translate();
                com.defaultDesc  = "CommandAutoRearmDesc".Translate();
                com.hotKey       = KeyBindingDefOf.Misc3;
                com.icon         = TexCommand.RearmTrap;
                com.isActive     = (() => this.autoRearm);
                com.toggleAction = delegate()
                {
                    this.autoRearm = !this.autoRearm;
                };
                this.$current = com;
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);
            }
 public void Weak_reference_can_be_written()
 {
     {
         var r = new Repository<Gizmo>(_sx);
         var g3 = new Gizmo
         {
             Id = "g3",
             Name = "weeeeaaaak",
             Primary = Reference.To<Widget>("w6"),
         };
         Assert.DoesNotThrow(() => r.Save(g3));
     }
     {
         var r = new Repository<Gizmo>(_sx2);
         var g3 = r.Get("g3");
         Assert.That(g3.Primary.Value.Cost, Is.EqualTo(55));
     }
 }