当前位置: 首页>>代码示例>>C#>>正文


C# Thing类代码示例

本文整理汇总了C#中Thing的典型用法代码示例。如果您正苦于以下问题:C# Thing类的具体用法?C# Thing怎么用?C# Thing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Thing类属于命名空间,在下文中一共展示了Thing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanDesignateThing

 public override AcceptanceReport CanDesignateThing( Thing t )
 {
     var building = t.GetInnerIfMinified() as Building;
     if (building?.def.category != ThingCategory.Building)
     {
         return false;
     }
     if (!Game.GodMode)
     {
         if (!building.def.building.IsDeconstructible)
         {
             return false;
         }
         if (building.Faction != Faction.OfColony)
         {
             if (building.Faction != null)
             {
                 return false;
             }
             if (!building.ClaimableBy( Faction.OfColony ))
             {
                 return false;
             }
         }
     }
     if (Find.DesignationManager.DesignationOn( t, DesignationDefOf.Deconstruct ) != null)
     {
         return false;
     }
     return Find.DesignationManager.DesignationOn( t, DesignationDefOf.Uninstall ) == null;
 }
开发者ID:ChaosTherum,项目名称:RimWorld-RedistHeat,代码行数:31,代码来源:Designator_DeconstructReversed.cs

示例2: InitAsync

 public async Task<Comment> InitAsync(Reddit reddit, JToken json, IWebAgent webAgent, Thing sender)
 {
     var data = CommonInit(reddit, json, webAgent, sender);
     await ParseCommentsAsync(reddit, json, webAgent, sender);
     await Task.Factory.StartNew(() => JsonConvert.PopulateObject(data.ToString(), this, reddit.JsonSerializerSettings));
     return this;
 }
开发者ID:anavaino,项目名称:RedditSharp,代码行数:7,代码来源:Comment.cs

示例3: WieldUnwieldEvent

 /// <summary>
 /// Initializes a new instance of the <see cref="WieldUnwieldEvent"/> class.
 /// </summary>
 /// <param name="wieldedItem">The thing being affected by this event.</param>
 /// <param name="isBeingWielded">Whether the thing is being wielded (true) or unwielded (false).</param>
 /// <param name="activeThing">The actor causing the event (if applicable).</param>
 /// <param name="sensoryMessage">The message to display to those who can perceive the change.</param>
 public WieldUnwieldEvent(Thing wieldedItem, bool isBeingWielded, Thing activeThing, SensoryMessage sensoryMessage)
     : base(activeThing, sensoryMessage)
 {
     this.WieldedItem = wieldedItem;
     this.IsBeingWielded = isBeingWielded;
     sensoryMessage.Context.Add("WieldedItem", this.WieldedItem);
 }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:14,代码来源:WieldUnwieldEvent.cs

示例4: save

        public static void save(List<Thing> thingsToSave, string fileLocation, Thing source)
        {
            Scribe.InitWriting(fileLocation,"Stargate");

            //Log.Message("Starting Save");
            //Save Pawn

            //Scribe_Collections.LookList<Thing>(ref thingsToSave, "things", LookMode.Deep, (object)null);

            //Scribe.EnterNode("map");
            //Scribe.EnterNode("things");
            //source.ExposeData();
            Scribe_Collections.LookList<Thing>(ref thingsToSave, "things", LookMode.Deep, (object)null);
            //Scribe.ExitNode();

            //Scribe.ExitNode();

            /*
            for (int i = 0; i < thingsToSave.Count; i++)
            {
                Scribe_Deep.LookDeep<Thing>(ref thingsToSave[i], thingsToSave[i].ThingID);
            }*/

            Scribe.FinalizeWriting();
            Scribe.mode = LoadSaveMode.Inactive;
            //Log.Message("End Save");
        }
开发者ID:A-Nitram,项目名称:Jaxxa-Rimworld,代码行数:27,代码来源:SaveThings.cs

示例5: UpdateContributor

    public override void UpdateContributor(Thing contributor)
    {
        base.UpdateContributor (contributor);

        //On(contributor, SensorType.OnSensorEnter, OnSensorEnter);
        //On(contributor, SensorType.OnSensorExit, OnSensorExit);
    }
开发者ID:youdiaozi,项目名称:HTCViveExperiments,代码行数:7,代码来源:SegueManager.cs

示例6: CommentViewModel

        public CommentViewModel(IBaconProvider baconProvider, Thing comment, string linkId, bool oddNesting, int depth = 0)
        {
            _isMinimized = false;
            _comment = new TypedThing<Comment>(comment);
            _baconProvider = baconProvider;
            _redditService = _baconProvider.GetService<IRedditService>();
            _navigationService = _baconProvider.GetService<INavigationService>();
            _userService = _baconProvider.GetService<IUserService>();
            _dynamicViewLocator = _baconProvider.GetService<IDynamicViewLocator>();
            _markdownProcessor = _baconProvider.GetService<IMarkdownProcessor>();
            _linkId = linkId;
            OddNesting = oddNesting;
			Depth = depth;
            AuthorFlair = _redditService.GetUsernameModifiers(_comment.Data.Author, _linkId, _comment.Data.Subreddit);
            AuthorFlairText = _comment.Data.AuthorFlairText;
            _showExtendedView = new RelayCommand(ShowExtendedViewImpl);
            _gotoReply = new RelayCommand(GotoReplyImpl);
            _save = new RelayCommand(SaveImpl);
            _report = new RelayCommand(ReportImpl);
            _gotoFullLink = new RelayCommand(GotoFullLinkImpl);
            _gotoContext = new RelayCommand(GotoContextImpl);
            _gotoUserDetails = new RelayCommand(GotoUserDetailsImpl);
            _gotoEdit = new RelayCommand(GotoEditImpl);
            _minimizeCommand = new RelayCommand(() => IsMinimized = !IsMinimized);
            Body = _comment.Data.Body;
        }
开发者ID:Synergex,项目名称:Baconography,代码行数:26,代码来源:CommentViewModel.cs

示例7: HasJobOnThing

 public override bool HasJobOnThing(Pawn pawn, Thing t)
 {
     Fire fire = t as Fire;
     if (fire == null)
     {
         return false;
     }
     Area outpostArea = OG_Util.FindOutpostArea();
     Pawn pawn2 = fire.parent as Pawn;
     if (pawn2 != null)
     {
         if (pawn2 == pawn)
         {
             return false;
         }
         if ((pawn2.Faction == pawn.Faction || pawn2.HostFaction == pawn.Faction || pawn2.HostFaction == pawn.HostFaction)
             && ((outpostArea == null) || (outpostArea.ActiveCells.Contains(t.Position) == false))
             && IntVec3Utility.ManhattanDistanceFlat(pawn.Position, pawn2.Position) > 15)
         {
             return false;
         }
     }
     else if ((outpostArea == null)
         || (outpostArea.ActiveCells.Contains(t.Position) == false))
     {
         return false;
     }
     return ((pawn.Position - fire.Position).LengthHorizontalSquared <= 225f || pawn.CanReserve(fire, 1)) && !WorkGiver_FightFiresOutpost.FireIsBeingHandled(fire, pawn);
 }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:29,代码来源:WorkGiver_FightFiresOutpost.cs

示例8: HasJobOnThing

		public override bool HasJobOnThing(Pawn pawn, Thing t)
		{
            if ((t is Building_AquacultureBasin) == false)
            {
                return false;
            }
            Building_AquacultureBasin aquacultureBasin = t as Building_AquacultureBasin;

            if (pawn.Dead
                || pawn.Downed
                || pawn.IsBurning())
            {
                return false;
            }
            if (pawn.CanReserveAndReach(aquacultureBasin, this.PathEndMode, Danger.Some) == false)
            {
                return false;
            }

            if (aquacultureBasin.breedingIsFinished)
            {
                return true;
            }
            return false;
		}
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:25,代码来源:WorkGiver_AquaponicBasin.cs

示例9: Load

        /// <summary>
        /// Loads this instance.
        /// </summary>
        public void Load()
        {
            var areaRepository = new AreaRepository();

            // @@@ TODO: Fix hack: http://www.wheelmud.net/tabid/59/aft/1622/Default.aspx
            string areaNumber = this.Parent.ID.Replace("area/", string.Empty);
            long persistedAreaID = long.Parse(areaNumber);
            ICollection<RoomRecord> rooms = areaRepository.GetRoomsForArea(persistedAreaID);

            foreach (var roomRecord in rooms)
            {
                // @@@ TODO: Fix hack: http://www.wheelmud.net/tabid/59/aft/1622/Default.aspx
                var roomBehavior = new RoomBehavior()
                {
                    ID = roomRecord.ID,
                };
                var currRoom = new Thing(roomBehavior)
                {
                    Name = roomRecord.Name,
                    Description = roomRecord.Description,
                    ID = "room/" + roomRecord.ID,
                };

                // Load this room and it's children.
                roomBehavior.Load();
                this.Parent.Add(currRoom);
            }
        }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:31,代码来源:AreaBehavior.cs

示例10: JobOnThing

 public override Job JobOnThing(Pawn pawn, Thing t)
 {
     Vehicle_Cart cart = t as Vehicle_Cart;
     if (cart == null)
         return (Job)null;
     if (cart.IsForbidden(pawn.Faction) || !ReservationUtility.CanReserveAndReach(pawn, cart, PathEndMode.ClosestTouch, DangerUtility.NormalMaxDanger(pawn)))
         return (Job)null;
     if (FireUtility.IsBurning(cart))
     {
         JobFailReason.Is(ToolsForHaulUtility.BurningLowerTrans);
         return (Job)null;
     }
     if (ListerHaulables.ThingsPotentiallyNeedingHauling().Count == 0 && cart.storage.Count == 0)
     {
         JobFailReason.Is(ToolsForHaulUtility.NoHaulable);
         return (Job)null;
     }
     if (Find.SlotGroupManager.AllGroupsListInPriorityOrder.Count == 0)
     {
         JobFailReason.Is(ToolsForHaulUtility.NoEmptyPlaceLowerTrans);
         return (Job)null;
     }
     if (ToolsForHaulUtility.AvailableAnimalCart(cart) || ToolsForHaulUtility.AvailableCart(cart, pawn))
         return ToolsForHaulUtility.HaulWithTools(pawn, cart);
     JobFailReason.Is(ToolsForHaulUtility.NoAvailableCart);
     return (Job)null;
 }
开发者ID:BBream,项目名称:ToolsForHaul,代码行数:27,代码来源:WorkGiver_HaulWithCart.cs

示例11: AnimalAwareOfEx

        /// <summary>
        /// Better version of base AnimalAwareOf that works for Things with passability XML
        /// set to Impassable. 
        /// </summary>
        public static bool AnimalAwareOfEx(this Pawn p, Thing t)
        {
            if (p.RaceProps.ToolUser || p.Faction != null)
            {
                return true;
            }

            var pRoom = p.GetRoom();
            List<Room> thingRooms = new List<Room>();
            if (t.def.passability != Traversability.Impassable)
            {
                thingRooms.Add(t.GetRoom());
            }
            else
            {
                // Find the rooms that are adjacent to the impassable Thing.
                foreach (IntVec3 pos in GenAdj.CellsAdjacent8Way(t))
                {
                    var room = pos.GetRoom();
                    if (room == null) continue;
                    thingRooms.Add(room);
                }
            }

            return ((p.Position - t.Position).LengthHorizontalSquared <= 900f &&
                thingRooms.Any(tRoom => tRoom == pRoom) &&
                GenSight.LineOfSight(p.Position, t.Position, false));
        }
开发者ID:achan1989,项目名称:Dehydration,代码行数:32,代码来源:PawnLocalAwareness.cs

示例12: SpawnSetup

        public override void SpawnSetup()
        {
            base.SpawnSetup();

            // Initialize take-off tick.
            takeOffTick = Find.TickManager.TicksGame + ressuplyDuration;

            // Spawn cryptosleep bays.
            if (this.cryptosleepBay1 == null)
            {
                cryptosleepBay1 = ThingMaker.MakeThing(OG_Util.SupplyShipCryptosleepBayLeftDef);
                cryptosleepBay1.SetFactionDirect(this.Faction);
                GenSpawn.Spawn(cryptosleepBay1, this.Position + new IntVec3(-4, 0, -2).RotatedBy(this.Rotation), this.Rotation);
            }
            if (this.cryptosleepBay2 == null)
            {
                cryptosleepBay2 = ThingMaker.MakeThing(OG_Util.SupplyShipCryptosleepBayRightDef);
                cryptosleepBay2.SetFactionDirect(this.Faction);
                GenSpawn.Spawn(cryptosleepBay2, this.Position + new IntVec3(3, 0, -2).RotatedBy(this.Rotation), this.Rotation);
            }
            // Spawn cargo bays.
            if (this.cargoBay1 == null)
            {
                cargoBay1 = ThingMaker.MakeThing(OG_Util.SupplyShipCargoBayLeftDef);
                cargoBay1.SetFactionDirect(this.Faction);
                GenSpawn.Spawn(cargoBay1, this.Position + new IntVec3(-4, 0, 1).RotatedBy(this.Rotation), this.Rotation);
            }
            if (this.cargoBay2 == null)
            {
                cargoBay2 = ThingMaker.MakeThing(OG_Util.SupplyShipCargoBayRightDef);
                cargoBay2.SetFactionDirect(this.Faction);
                GenSpawn.Spawn(cargoBay2, this.Position + new IntVec3(4, 0, 1).RotatedBy(this.Rotation), this.Rotation);
            }
        }
开发者ID:Rikiki123456789,项目名称:Rimworld,代码行数:34,代码来源:Building_SupplyShip.cs

示例13: FloatMenuOption_Group

 public FloatMenuOption_Group(string label, Action action, Designator designator,
     MenuOptionPriority priority = MenuOptionPriority.Medium, Action mouseoverGuiAction = null,
     Thing revalidateClickTarget = null)
     : base(label, action, priority, mouseoverGuiAction, revalidateClickTarget)
 {
     this.designator = designator;
 }
开发者ID:RWA-Team,项目名称:RimworldAscension,代码行数:7,代码来源:FloatMenuOption_Group.cs

示例14: EnterEvent

 /// <summary>
 /// Initializes a new instance of the <see cref="EnterEvent"/> class.
 /// </summary>
 /// <param name="thingEntered">The thing entered.</param>
 /// <param name="activeThing">The active thing.</param>
 /// <param name="sensoryMessage">The sensory message.</param>
 /// <param name="startLocation">The start location.</param>
 /// <param name="endLocation">The end location.</param>
 public EnterEvent(Thing thingEntered, Thing activeThing, SensoryMessage sensoryMessage, Thing startLocation, Thing endLocation)
     : base(activeThing, sensoryMessage)
 {
     this.ThingEntered = thingEntered;
     this.StartLocation = startLocation;
     this.EndLocation = endLocation;
 }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:15,代码来源:EnterEvent.cs

示例15: Ignite

 private Toil Ignite(Thing target)
 {
     Toil toil = new Toil();
     toil.initAction = delegate
     {
         Pawn feenix = this.pawn;
         if (target.FlammableNow && !target.IsBurning())
         {
             if (target.CanEverAttachFire())
             {
                 target.TryAttachFire(1f);
             }
             else
             {
                 FireUtility.TryStartFireIn(target.Position, 1f);
             }
             PawnUtility.ForceWait(feenix, 250, target);
         }
         else
         {
             return;
         }
     };
     toil.defaultCompleteMode = ToilCompleteMode.Delay;
     toil.defaultDuration = 250;
     return toil;
 }
开发者ID:FluffierThanThou,项目名称:RW_Cats,代码行数:27,代码来源:JobDriver_IgniteFire.cs


注:本文中的Thing类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。