Example #1
0
 public uiPaint(
     uiColor?color             = null,
     BlendMode blendMode       = BlendMode.srcOver,
     PaintingStyle style       = PaintingStyle.fill,
     float strokeWidth         = 0f,
     StrokeCap strokeCap       = StrokeCap.butt,
     StrokeJoin strokeJoin     = StrokeJoin.miter,
     float strokeMiterLimit    = 4.0f,
     FilterMode filterMode     = FilterMode.Bilinear,
     uiColorFilter?colorFilter = null,
     uiMaskFilter?maskFilter   = null,
     uiImageFilter backdrop    = null,
     PaintShader shader        = null,
     bool invertColors         = false
     )
 {
     this.color            = color ?? _kColorDefault;
     this.blendMode        = blendMode;
     this.style            = style;
     this.strokeWidth      = strokeWidth;
     this.strokeCap        = strokeCap;
     this.strokeJoin       = strokeJoin;
     this.strokeMiterLimit = strokeMiterLimit;
     this.filterMode       = filterMode;
     this.colorFilter      = colorFilter;
     this.maskFilter       = maskFilter;
     this.backdrop         = backdrop;
     this.shader           = shader;
     this.invertColors     = invertColors;
 }
Example #2
0
 public uiPaint(uiPaint paint)
 {
     this.color            = paint.color;
     this.blendMode        = paint.blendMode;
     this.style            = paint.style;
     this.strokeWidth      = paint.strokeWidth;
     this.strokeCap        = paint.strokeCap;
     this.strokeJoin       = paint.strokeJoin;
     this.strokeMiterLimit = paint.strokeMiterLimit;
     this.filterMode       = paint.filterMode;
     this.colorFilter      = paint.colorFilter;
     this.maskFilter       = paint.maskFilter;
     this.backdrop         = paint.backdrop;
     this.shader           = paint.shader;
     this.invertColors     = paint.invertColors;
 }
Example #3
0
        public Paint(Paint paint)
        {
            D.assert(paint != null);

            this.color            = paint.color;
            this.blendMode        = paint.blendMode;
            this.style            = paint.style;
            this.strokeWidth      = paint.strokeWidth;
            this.strokeCap        = paint.strokeCap;
            this.strokeJoin       = paint.strokeJoin;
            this.strokeMiterLimit = paint.strokeMiterLimit;
            this.filterMode       = paint.filterMode;
            this.colorFilter      = paint.colorFilter;
            this.maskFilter       = paint.maskFilter;
            this.shader           = paint.shader;
            this.invertColors     = paint.invertColors;
        }
Example #4
0
        protected override bool PrivateUpdate(ScenarioFrame frame)
        {
            base.PrivateUpdate(frame);

            mNet = 0;

            Camera camera = ManagedBuyProduct <Camera> .Purchase(Sim, 0, this, UnlocalizedName, null, BuildBuyProduct.eBuyCategory.kBuyCategoryElectronics, BuildBuyProduct.eBuySubCategory.kBuySubCategoryHobbiesAndSkills);

            if (camera == null)
            {
                return(false);
            }

            Photography skill = Sim.SkillManager.GetSkill <Photography>(SkillNames.Photography);

            if (skill == null)
            {
                skill = Sim.SkillManager.AddElement(SkillNames.Photography) as Photography;
            }

            List <PhotographSize> sizes = new List <PhotographSize>();

            foreach (PhotographSize size in sSizes)
            {
                if (Photography.SizeUnlocked(skill, size))
                {
                    sizes.Add(size);
                }
            }

            if (sizes.Count == 0)
            {
                IncStat("No Sizes");
                return(false);
            }

            List <PaintingStyle> styles = new List <PaintingStyle>();

            foreach (PaintingStyle style in sStyles)
            {
                if (Photography.StyleUnlocked(skill, style))
                {
                    styles.Add(style);
                }
            }

            if (styles.Count == 0)
            {
                IncStat("No Styles");
                return(false);
            }

            List <SubjectDefinition> subjects = new List <SubjectDefinition>();

            foreach (CollectionDefinition collection in PhotographySubjects.sCollectionDefinitions.Values)
            {
                if (!collection.AvailableForSkill(skill))
                {
                    continue;
                }

                if (collection.Location != WorldName.UserCreated)
                {
                    continue;
                }

                foreach (SubjectDefinition definition in collection.Subjects)
                {
                    try
                    {
                        if (!definition.AvailableForSkill(skill))
                        {
                            continue;
                        }
                    }
                    catch
                    {
                        continue;
                    }

                    subjects.Add(definition);
                }
            }

            if (subjects.Count == 0)
            {
                IncStat("No Subjects");
                return(false);
            }

            int additional = AddScoring("AdditionalPhoto", Sim);

            int total = Sims3.Gameplay.Core.RandomUtil.GetInt(GetValue <Option, int>() + additional);

            if (total <= 0)
            {
                total = 1;
            }

            int totalFunds = 0;

            for (int i = 0; i < total; i++)
            {
                PhotographSize size  = Sims3.Gameplay.Core.RandomUtil.GetRandomObjectFromList(sizes);
                PaintingStyle  style = Sims3.Gameplay.Core.RandomUtil.GetRandomObjectFromList(styles);

                int cost = Photography.GetCostToTakePhoto(skill, camera, size, style);
                if (Sim.FamilyFunds < cost)
                {
                    continue;
                }

                float x    = 0f;
                float num3 = 1f;
                float num5 = 0f;
                float num6 = 1f;

                SubjectDefinition subject = Sims3.Gameplay.Core.RandomUtil.GetRandomObjectFromList(subjects);

                skill.ApplyMultiplier(ref num6, camera.CameraTuning.ValueMultiplier, "Value", "CameraTuning");

                bool newSubject, firstShotTodayOfSubject, collectionComplete;
                UpdateRecords(skill, camera, subject, style, size, out newSubject, out firstShotTodayOfSubject, out collectionComplete);

                if (newSubject)
                {
                    skill.ApplyBonus(ref x, (float)subject.SkillPoints, "Skill Gain", "Subject Tuning (New Subject)");
                    skill.ApplyBonus(ref num5, (float)subject.Value, "Value", "Subject Tuning (New Subject)");
                }
                else if (firstShotTodayOfSubject)
                {
                    skill.ApplyBonus(ref x, subject.SkillPoints * Photography.kFirstShotOfTheDaySkillGainMultiplier, "Skill Gain", "Subject Tuning (First Time Today)");
                    skill.ApplyBonus(ref num5, subject.Value * Photography.kFirstShotOfTheDayValueMultiplier, "Value", "Subject Tuning (First Time Today)");
                }

                if (Sims3.Gameplay.Core.RandomUtil.RandomChance((skill.MaxSkillLevel - (skill.SkillLevel - 1)) * 10))
                {
                    skill.ApplyMultiplier(ref num6, Photography.kBadPhotoValueMultiplier, "Value", "Bad Photo (kBadPhotoValueMultiplier)");
                }

                skill.ApplyMultiplier(ref num6, Photography.sValueMultipliers[skill.SkillLevel], "Value", "Sim's Skill Level");
                skill.ApplyMultiplier(ref num6, Photography.sSizeData[size].ValueMultiplier, "Value", "Photo Size");
                skill.ApplyMultiplier(ref num6, Photography.sStyleData[style].ValueMultiplier, "Value", "Photo Style");

                if (collectionComplete)
                {
                    skill.ApplyMultiplier(ref num6, subject.Collection.ValueMultiplierWhenComplete, "Value", "Collection Tuning (Complete)");
                }
                else
                {
                    skill.ApplyMultiplier(ref num6, subject.Collection.ValueMultiplier, "Value", "Collection Tuning");
                }

                if (Sim.TraitManager.HasElement(TraitNames.PhotographersEye))
                {
                    skill.ApplyMultiplier(ref num6, TraitTuning.PhotographersEyePhotographValueMultiplier, "Value", "Photographer's Eye (TraitTuning)");
                }

                skill.ApplyMultiplier(ref num3, camera.CameraTuning.SkillGainMultiplier, "Skill Gain", "CameraTuning");

                int funds = (int)((Photography.kBaseValuePerPhoto + num5) * num6);

                if ((funds < cost) && (additional > 0))
                {
                    IncStat("Try Again");
                    total++;
                    additional--;
                }

                skill.EarnedMoneyFromPhotography((uint)funds);
                skill.UpdateXpForEarningMoney(funds);

                totalFunds += funds;

                AddStat("Subject: " + subject.Name, funds);

                AddStat("Funds", funds);

                Money.AdjustFunds(Sim, "Photography", -cost);

                AddStat("Cost", cost);

                skill.SpentMoneyOnPhotography((uint)cost);

                AddScoring("Net", funds - cost);

                mNet += (funds - cost);

                float points = (Photography.kBaseSkillGainPerPhoto + x) * num3;

                AddStat("Skill", points);

                skill.AddPoints(points);
                skill.CheckForCompletedOpportunities();
            }

            Money.AdjustFunds(Sim, "Photography", totalFunds);

            return(mNet > 0);
        }
Example #5
0
        protected static void UpdateRecords(Photography skill, Sims3.Gameplay.Objects.HobbiesSkills.Camera camera, SubjectDefinition subject, PaintingStyle style, PhotographSize size, out bool newSubject, out bool firstShotTodayOfSubject, out bool collectionComplete)
        {
            newSubject = false;
            firstShotTodayOfSubject = false;
            collectionComplete      = false;

            Photography.SubjectRecord record;

            string str  = subject.Key;
            string str2 = subject.Collection.Key;

            if (str != "Nothing")
            {
                if (!skill.mSubjectRecords.TryGetValue(str, out record))
                {
                    record = new Photography.SubjectRecord();
                    record.SetUIState(Photography.UIState.NewlyDiscovered);
                    skill.OnNewSubjectCaptured(skill.SkillOwner.CreatedSim, subject, camera);
                    skill.mSubjectRecords[str] = record;
                }
                firstShotTodayOfSubject = Photography.WouldBeNewToday(record);
                Photography.UpdateRecord(record, null);
                newSubject = record.mCaptureCount == 0x1;
                if (!skill.mCollectionRecords.TryGetValue(str2, out record))
                {
                    record = new Photography.SubjectRecord();
                    skill.mCollectionRecords[str2] = record;
                }
                if (record.mCaptureCount == 0x0)
                {
                    record.SetUIState(Photography.UIState.NewlyDiscovered);
                    skill.OnNewCollectionDiscovered(skill.SkillOwner.CreatedSim, subject.Collection, subject, camera);
                }
                Photography.UpdateRecord(record, null);

                collectionComplete = skill.HasCompletedCollection(str2);
                if (newSubject && collectionComplete)
                {
                    record.SetUIState(Photography.UIState.NewlyCompleted);
                    skill.mCollectionsCompleted++;
                }
            }
            if (!skill.mStyleRecords.TryGetValue(style, out record))
            {
                record = new Photography.SubjectRecord();
                skill.mStyleRecords[style] = record;
            }
            Photography.UpdateRecord(record, null);
            if (!skill.mSizeRecords.TryGetValue(size, out record))
            {
                record = new Photography.SubjectRecord();
                skill.mSizeRecords[size] = record;
            }
            Photography.UpdateRecord(record, null);
        }