Example #1
0
        public SimAvatar(SimAvatar old)
            : base(old.BaseSkeleton)
        {
            m_Handgroup = old.m_Handgroup;
            m_Body = old.m_Body;
            m_Head = old.m_Head;

            ReloadSkeleton();
            ReloadHead();
            ReloadBody();
            ReloadHandgroup();
        }
 public Dialog_ManageOutfitsAutoEquip(Outfit selectedOutfit)
 {
     this.forcePause = true;
     this.doCloseX = true;
     this.closeOnEscapeKey = true;
     this.doCloseButton = true;
     this.closeOnClickedOutside = true;
     this.absorbInputAroundWindow = true;
     if (Dialog_ManageOutfitsAutoEquip.apparelGlobalFilter == null)
     {
         Dialog_ManageOutfitsAutoEquip.apparelGlobalFilter = new ThingFilter();
         Dialog_ManageOutfitsAutoEquip.apparelGlobalFilter.SetAllow(ThingCategoryDefOf.Apparel, true);
     }
     this.SelectedOutfit = selectedOutfit;
 }
 public BuilderVestBeret(){
     outfit = new Outfit();
 }
        public override void DoWindowContents(Rect inRect)
        {
            float num = 0f;
            Rect rect = new Rect(0f, 0f, 150f, 35f);
            num += 150f;
            if (Widgets.TextButton(rect, "SelectOutfit".Translate(), true, false))
            {
                List<FloatMenuOption> list = new List<FloatMenuOption>();
                foreach (Outfit current in Find.Map.outfitDatabase.AllOutfits)
                {
                    Outfit localOut = current;
                    list.Add(new FloatMenuOption(localOut.label, delegate
                    {
                        this.SelectedOutfit = localOut;
                    }, MenuOptionPriority.Medium, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list, false));
            }
            num += 10f;
            rect = new Rect(num, 0f, 150f, 35f);
            num += 150f;
            if (Widgets.TextButton(rect, "NewOutfit".Translate(), true, false))
            {
                this.SelectedOutfit = Find.Map.outfitDatabase.MakeNewOutfit();
            }
            num += 10f;
            rect = new Rect(num, 0f, 150f, 35f);
            num += 150f;
            if (Widgets.TextButton(rect, "DeleteOutfit".Translate(), true, false))
            {
                List<FloatMenuOption> list2 = new List<FloatMenuOption>();
                foreach (Outfit current2 in Find.Map.outfitDatabase.AllOutfits)
                {
                    Outfit localOut = current2;
                    list2.Add(new FloatMenuOption(localOut.label, delegate
                    {
                        AcceptanceReport acceptanceReport = Find.Map.outfitDatabase.TryDelete(localOut);
                        if (!acceptanceReport.Accepted)
                        {
                            Messages.Message(acceptanceReport.Reason, MessageSound.RejectInput);
                        }
                        else
                        {
                            if (localOut == this.SelectedOutfit)
                            {
                                this.SelectedOutfit = null;
                            }
                            foreach (Saveable_Outfit s in MapComponent_AutoEquip.Get.outfitCache.Where(i => i.outfit == localOut).ToArray())
                                MapComponent_AutoEquip.Get.outfitCache.Remove(s);
                        }
                    }, MenuOptionPriority.Medium, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list2, false));
            }
            rect = new Rect(0f, 40f, 300f, inRect.height - 40f - this.CloseButSize.y).ContractedBy(10f);
            if (this.SelectedOutfit == null)
            {
                GUI.color = Color.grey;
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(rect, "NoOutfitSelected".Translate());
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color = Color.white;
                return;
            }
            GUI.BeginGroup(rect);
            Rect rect1 = new Rect(0f, 0f, 200f, 30f);
            Dialog_ManageOutfitsAutoEquip.DoNameInputRect(rect1, ref this.SelectedOutfit.label, 30);
            rect1 = new Rect(0f, 40f, rect.width, rect.height - 45f - 10f);
            ThingFilterUI.DoThingFilterConfigWindow(rect1, ref this.scrollPosition, this.SelectedOutfit.filter, Dialog_ManageOutfitsAutoEquip.apparelGlobalFilter, 16);
            GUI.EndGroup();

            rect = new Rect(300f, 40f, inRect.width - 300f, inRect.height - 40f - this.CloseButSize.y).ContractedBy(10f);
            GUI.BeginGroup(rect);

            rect1 = new Rect(0f, 0f, rect.width, 30f);
            Widgets.LabelCheckbox(rect1, "AutoEquipAppendIndividualPawnStatus".Translate(), ref MapComponent_AutoEquip.Get.GetOutfit(this.SelectedOutfit).appendIndividualPawnStatus);

            rect1 = new Rect(0f, 40f, rect.width, rect.height - 45f - 10f);
            Dialog_ManageOutfitsAutoEquip.DoStatsInput(rect1, ref this.scrollPositionStats, MapComponent_AutoEquip.Get.GetOutfit(this.SelectedOutfit).stats);
            GUI.EndGroup();
        }
 public BuilderJacketBeret(){
     outfit = new Outfit();
 }
Example #6
0
    IEnumerator DisplayCards()
    {
        WWW www2;
        Vector3 destination;
        for (int i=0; i<3; i++)
        {
            www2 = new WWW(cardData[i]["image"].ToString());
            yield return www2;

            cardSound.Play ();
            GameObject current = new GameObject();
            SpriteRenderer renderer =  current.AddComponent<SpriteRenderer>();
            renderer.sortingOrder = 100;
            Sprite sprite = new Sprite();
            float pixelsToUnits = www2.texture.width / (screenWidthUnit/1.5f);
            sprite = Sprite.Create(www2.texture, new Rect(0, 0, www2.texture.width, www2.texture.height),new Vector2(0.5f, 0.5f),pixelsToUnits);
            renderer.sprite = sprite;
            current.transform.localScale = new Vector3 (1.2f, 1.2f, 1.2f);

            GameObject brand = new GameObject();
            renderer =  brand.AddComponent<SpriteRenderer>();
            renderer.sprite = Resources.Load<Sprite>("03_hover");
            brand.transform.parent = current.transform;
            brand.transform.localPosition = new Vector3 (0,  screenWidthUnit * 0.52f , 0);
            brand.transform.localScale = new Vector3 (1.5f,0.7f,1f);
            brand.GetComponent<Renderer> ().sortingOrder = 100;

            GameObject brandname = Instantiate(tagModel2, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            brandname.transform.parent = brand.transform;
            brandname.transform.localPosition = new Vector3 (0,  0 , 0);
            brandname.transform.localScale = new Vector3 (0.02f,0.04f,0.02f);
            brandname.GetComponent<Renderer> ().sortingOrder = 100;
            brandname.GetComponent<TextMesh> ().text =  cardData[i]["brand"].ToString() ;

            Outfit card = new Outfit(current, int.Parse(cardData[i]["sale_price"].ToString()),int.Parse(cardData[i]["retail_price"].ToString()),cardData[i]["url"].ToString(),cardData[i]["category"].ToString(),cardData[i]["brand"].ToString(),cardData[i]["image"].ToString());
            cards[i] = card;

            yield return new WaitForSeconds(1.5f);
            destination = new Vector3 (screenWidthUnit / 3.0f * (i  + 0.5f) - screenWidthUnit / 2.0f, screenWidthUnit*3.5f/2.5f/5.5f,0);
            StartCoroutine(Fade(cards[i].picture,destination,0.5f));
        }

        for (int i=0; i<3; i++)
        {
            cards[i].picture.AddComponent<BoxCollider2D>() ;
            cards[i].picture.AddComponent<ClickBehavior>() ;
        }
    }
 protected WomanDecorator(Outfit outfit)
 {
     this.Outfit = outfit;
 }
Example #8
0
 public void AddOutfit(Outfit outfit)
 {
     AddUInt16(outfit.LookType);
     if (outfit.LookType != 0)
     {
         AddByte(outfit.Head);
         AddByte(outfit.Body);
         AddByte(outfit.Legs);
         AddByte(outfit.Feet);
         AddByte(outfit.Addons);
     }
     else
     {
         AddUInt16(outfit.LookItem);
     }
 }
 public BuilderVestCap(){
     outfit = new Outfit();
 }
Example #10
0
        /// <summary>
        /// User clicked on an item in the list containing available heads and bodies.
        /// </summary>
        private void LstHeads_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (m_Skeleton == null)
            {
                m_Skeleton = new Skeleton(this.Device, ContentManager.GetResourceFromLongID(0x100000005));
                m_Skeleton.AssignChildren(ref m_Skeleton);
            }

            foreach(KeyValuePair<ulong, string> Pair in ContentManager.Resources)
            {
                if ((string)LstHeads.SelectedItem == Pair.Value)
                {
                    //HAndGroup files are used to group together different hand meshes and textures.
                    if (Pair.Value.Contains(".hag"))
                    {
                        Hag HandGroup = new Hag(ContentManager.GetResourceFromLongID(Pair.Key));

                        m_CurrentAppearance = new Appearance(ContentManager.GetResourceFromLongID(
                            HandGroup.Appearances[0]));

                        LstAppearances.Items.Clear();

                        foreach (ulong AppearanceID in HandGroup.Appearances)
                            LstAppearances.Items.Add(AppearanceID);

                        List<Binding> Bindings = new List<Binding>();

                        foreach (ulong BindingID in m_CurrentAppearance.BindingIDs)
                            Bindings.Add(new Binding(ContentManager.GetResourceFromLongID(BindingID)));

                        m_Tex = Texture2D.FromFile(this.Device, new MemoryStream(
                            ContentManager.GetResourceFromLongID(Bindings[0].TextureAssetID)));

                        m_CurrentMesh = new Mesh(ContentManager.GetResourceFromLongID(Bindings[0].MeshAssetID), false);
                        LoadMesh(m_CurrentMesh);
                    }
                    else
                    {
                        PurchasableObject PO = new PurchasableObject(ContentManager.GetResourceFromLongID(Pair.Key));

                        m_CurrentOutfit = new Outfit(ContentManager.GetResourceFromLongID(PO.OutfitID));
                        m_CurrentAppearance = new Appearance(
                            ContentManager.GetResourceFromLongID(m_CurrentOutfit.LightAppearanceID));

                        LstAppearances.Items.Clear();
                        LstAppearances.Items.Add(m_CurrentOutfit.LightAppearanceID);
                        LstAppearances.Items.Add(m_CurrentOutfit.MediumAppearanceID);
                        LstAppearances.Items.Add(m_CurrentOutfit.DarkAppearanceID);

                        List<Binding> Bindings = new List<Binding>();

                        foreach (ulong BindingID in m_CurrentAppearance.BindingIDs)
                            Bindings.Add(new Binding(ContentManager.GetResourceFromLongID(BindingID)));

                        m_Tex = Texture2D.FromFile(this.Device, new MemoryStream(
                            ContentManager.GetResourceFromLongID(Bindings[0].TextureAssetID)));

                        //The file selected was most likely a body-mesh, so apply the adult skeleton to it.
                        if (Pair.Value.Contains("bodies"))
                        {
                            m_CurrentMesh = new Mesh(ContentManager.GetResourceFromLongID(Bindings[0].MeshAssetID), true);
                            m_CurrentMesh.TransformVertices2(m_Skeleton.Bones[0], ref mSimpleEffect);
                            m_CurrentMesh.BlendVertices2();
                            LoadMesh(m_CurrentMesh);
                        }
                        else
                        {
                            m_CurrentMesh = new Mesh(ContentManager.GetResourceFromLongID(Bindings[0].MeshAssetID), false);
                            LoadMesh(m_CurrentMesh);
                        }
                    }

                    m_LoadComplete = true;
                }
            }
        }
Example #11
0
        public PawnCalcForApparel(Saveable_Pawn saveablePawn, Month month, float temperatureAjust)
        {
            this.saveablePawn = saveablePawn;
            this.pawn = saveablePawn.pawn;
            this.outfit = pawn.outfits.CurrentOutfit;
            this.stats = saveablePawn.NormalizeCalculedStatDef().ToArray();

            float targetTemperature = GenTemperature.AverageTemperatureAtWorldCoordsForMonth(Find.Map.WorldCoords, month) + temperatureAjust;

            #region [  needWarmCurve  ]

            float stat = this.pawn.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMin, null);

            stat = targetTemperature - stat;

            Log.Message("Target: " + targetTemperature + "     Stat: " + this.pawn.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMin, null) + "    Value: " + stat);

            if (stat > 10f)
                this.needWarmCurve = new SimpleCurve { new CurvePoint(0f, 1f) };
            else
                if (stat > 3f)
                    this.needWarmCurve = new SimpleCurve
                        {
                            new CurvePoint(+10f, -1.00f),
                            new CurvePoint(+03f, +0.00f),
                            new CurvePoint(+00f, +1.00f),
                            new CurvePoint(-03f, +1.10f)
                        };
                else
                    if (stat > 0)
                        this.needWarmCurve = new SimpleCurve
                            {
                                new CurvePoint(+03f, -1.00f),
                                new CurvePoint(+01f, -1.00f),
                                new CurvePoint(+00f, +1.00f),
                                new CurvePoint(-03f, +1.20f),
                                new CurvePoint(-10f, +1.50f)
                            };
                    else
                        if (stat > -3)
                            this.needWarmCurve = new SimpleCurve
                            {
                                new CurvePoint(+03f, -1.00f),
                                new CurvePoint(+01f, -1.00f),
                                new CurvePoint(+00f, +1.00f),
                                new CurvePoint(-03f, +1.20f),
                                new CurvePoint(-100f, +2.00f)
                            };
                        else
                            this.needWarmCurve = new SimpleCurve
                                {
                                    new CurvePoint(+01f, -1.00f),
                                    new CurvePoint(+00f, +1.00f),
                                    new CurvePoint(-03f, +1.50f),
                                    new CurvePoint(-100f, +20.00f)
                                };

            #endregion

            #region [  needCoolCurve  ]

            stat = this.pawn.def.GetStatValueAbstract(StatDefOf.ComfyTemperatureMax, null);

            stat = targetTemperature - stat;

            if (stat < -10)
                this.needCoolCurve = new SimpleCurve { new CurvePoint(0f, 1f) };
            else
                if (stat < -3)
                    this.needCoolCurve = new SimpleCurve
                        {
                            new CurvePoint(-10f, -1.00f),
                            new CurvePoint(-03f, +0.00f),
                            new CurvePoint(+00f, +1.00f),
                            new CurvePoint(+03f, +1.10f)
                        };
                else
                    if (stat < 0)
                        this.needCoolCurve = new SimpleCurve
                            {
                                new CurvePoint(-03f, -1.00f),
                                new CurvePoint(-01f, -1.00f),
                                new CurvePoint(+00f, +1.00f),
                                new CurvePoint(+03f, +1.20f),
                                new CurvePoint(+10f, +1.50f)
                            };
                    else
                        this.needCoolCurve = new SimpleCurve
                            {
                                new CurvePoint(-01f, -1.00f),
                                new CurvePoint(+00f, +1.00f),
                                new CurvePoint(+03f, +1.50f),
                                new CurvePoint(+100f, +20.00f)
                            };

            #endregion
        }
        public Saveable_Outfit GetOutfit(Outfit outfit)
        {
            foreach (Saveable_Outfit o in this.outfitCache)
                if (o.outfit == outfit)
                    return o;

            Saveable_Outfit ret = new Saveable_Outfit();
            ret.outfit = outfit;
            ret.stats.Add(new Saveable_StatDef() { statDef = StatDefOf.ArmorRating_Sharp, strength = 1.00f });
            ret.stats.Add(new Saveable_StatDef() { statDef = StatDefOf.ArmorRating_Blunt, strength = 0.75f });

            this.outfitCache.Add(ret);

            return ret;
        }
 public BuilderJacketCap(){
     outfit = new Outfit();
 }