示例#1
0
        public override void DoWindowContents(Rect inRect)
        {
            bool flag = false;

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
            {
                flag = true;
                Event.current.Use();
            }
            Text.Font = GameFont.Medium;
            string text = "Pack name: ";

            Widgets.Label(new Rect(15f, 15f, 500f, 50f), text);
            Text.Font = GameFont.Small;
            string text2 = Widgets.TextField(new Rect(15f, 50f, inRect.width / 2f - 20f, 35f), this.curPackName);

            if (text2.Length < 30 && CharacterCardUtility.ValidNameRegex.IsMatch(text2))
            {
                this.curPackName = text2;
            }
            if (Widgets.ButtonText(new Rect(inRect.width / 2f + 20f, inRect.height - 35f, inRect.width / 2f - 20f, 35f), "OK", true, true, true) || flag)
            {
                if (string.IsNullOrEmpty(this.curPackName))
                {
                    this.curPackName = RimValiUtility.GetPack(pawn).name;
                }
                RimValiUtility.GetPack(pawn).name = this.curPackName;
                Find.WindowStack.TryRemove(this, true);
            }
        }
示例#2
0
文件: Tab.cs 项目: Plythios/RimVali
        public virtual AvaliPack GetPack(Pawn pawn)
        {
            AvaliPack pack = null;

            pack = RimValiUtility.GetPack(pawn);
            return(pack);
        }
示例#3
0
 public Dialog_NamePack(Pawn pawn)
 {
     this.pawn                    = pawn;
     this.curPackName             = RimValiUtility.GetPack(pawn).name;
     this.forcePause              = true;
     this.absorbInputAroundWindow = true;
     this.closeOnClickedOutside   = true;
     this.closeOnAccept           = false;
 }
示例#4
0
        public void UpdatePawns(Map map)
        {
            IEnumerable <Pawn>      pawns = RimValiUtility.CheckAllPawnsInMapAndFaction(map, Faction.OfPlayer).Where(x => x.def == AvaliDefs.RimVali);
            IEnumerable <AvaliPack> packs = AvaliPackDriver.packs;

            foreach (Pawn pawn in pawns)
            {
                AvaliThoughtDriver avaliThoughtDriver = pawn.TryGetComp <AvaliThoughtDriver>();
                PackComp           packComp           = pawn.TryGetComp <PackComp>();
                if (!(avaliThoughtDriver == null))
                {
                    //Log.Message("Pawn has pack comp, moving to next step...");
                    if (AvaliPackDriver.packs == null || AvaliPackDriver.packs.Count == 0)
                    {
                        //Log.Message("How did we get here? [Pack list was 0 or null]");
                        return;
                    }
                    AvaliPack pawnPack = null;
                    //This errors out when pawns dont have a pack, in rare cases. That is bad. This stops it from doing that.
                    try { pawnPack = RimValiUtility.GetPack(pawn); }
                    catch
                    {
                        return;
                    }
                    //Log.Message("Tried to get packs pack, worked.");
                    if (pawnPack == null)
                    {
                        //Log.Message("How did we get here? [Pack was null.]");
                        break;
                    }
                    foreach (Pawn packmate in pawnPack.pawns)
                    {
                        Thought_Memory thought_Memory2 = (Thought_Memory)ThoughtMaker.MakeThought(packComp.Props.togetherThought);
                        if (!(packmate == pawn))
                        {
                            bool bubble;
                            if (!thought_Memory2.TryMergeWithExistingMemory(out bubble))
                            {
                                //Log.Message("Adding thought to pawn.");
                                pawn.needs.mood.thoughts.memories.TryGainMemory(thought_Memory2, packmate);
                            }
                        }
                    }
                    UpdateSharedRoomThought(pawn);
                }
            }
        }