Exemplo n.º 1
0
        protected static void ShowColorPickerTask()
        {
            try
            {
                CASMakeup ths = CASMakeup.gSingleton;
                if (ths == null)
                {
                    return;
                }

                CASPart part = new CASPart();
                if (CASMakeup.sCategory == BodyTypes.CostumeMakeup)
                {
                    if (ths.mCurrentPreset == null)
                    {
                        ICASModel      cASModel  = new CASModelProxy(Responder.Instance.CASModel);
                        List <CASPart> wornParts = cASModel.GetWornParts(CASMakeup.sCategory);

                        if (wornParts.Count > 0)
                        {
                            part = wornParts[wornParts.Count - 1];

                            ths.mCurrentPreset = new CASPartPreset(part, null);
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                else
                {
                    ths.mCurrentPreset = new CASPartPreset((CASPart)ths.mGridMakeupParts.SelectedTag, null);
                }

                CASMultiColorPickerDialog.OnColorsChanged += OnColorsChanged;
                CASMultiColorPickerDialog.OnColorsSaved   += OnColorsSaved;
                CASMultiColorPickerDialog.OnDialogClosed  += OnDialogClosed;
                if (CASMakeup.sCategory == BodyTypes.CostumeMakeup)
                {
                    ths.Tick -= ths.OnTick;
                }
                Color[] makeupColors = GetMakeupColors(ths, CASMakeup.sCategory);
                if (makeupColors != null)
                {
                    CASMultiColorPickerDialog.Show(makeupColors, makeupColors.Length, true, null);
                }
                if (CASMakeup.sCategory == BodyTypes.CostumeMakeup)
                {
                    ths.Tick += ths.OnTick;
                }
                CASMultiColorPickerDialog.OnColorsChanged -= OnColorsChanged;
                CASMultiColorPickerDialog.OnColorsSaved   -= OnColorsSaved;
                CASMultiColorPickerDialog.OnDialogClosed  -= OnDialogClosed;
            }
            catch (Exception e)
            {
                Common.Exception("ShowColorPickerTask", e);
            }
        }
Exemplo n.º 2
0
        public static void OnGridPartsClick(ItemGrid sender, ItemGridCellClickEvent args)
        {
            try
            {
                CASMakeup ths = CASMakeup.gSingleton;
                if (ths == null)
                {
                    return;
                }

                if (args.mTag is CASPart)
                {
                    CASModelProxy cASModel = new CASModelProxy(Responder.Instance.CASModel);

                    List <CASPart> wornParts = cASModel.GetWornParts(CASMakeup.sCategory);

                    CASPart tag = (CASPart)args.mTag;
                    if (tag.Key == ths.kInvalidCASPart.Key)
                    {
                        foreach (CASPart wornPart in wornParts)
                        {
                            cASModel.RequestRemoveCASPart(wornPart);
                        }
                    }
                    else if (wornParts.Contains(tag))
                    {
                        if (args.mButton == MouseKeys.kMouseRight)
                        {
                            cASModel.RequestRemoveCASPart(tag);
                        }
                        else
                        {
                            Color[] makeupColors = ths.GetMakeupColors(CASMakeup.sCategory);
                            ths.SetMakeupColors(tag, makeupColors, false, false);
                        }
                    }
                    else
                    {
                        cASModel.RequestAddCASPart(tag, false);

                        ths.mCurrentPreset = new CASPartPreset(tag, null);
                    }

                    Audio.StartSound("ui_tertiary_button");
                }
            }
            catch (Exception e)
            {
                Common.Exception("OnGridPartsClick", e);
            }
        }
Exemplo n.º 3
0
        public static void RemoveItem(CASMakeup ths, CASPart part)
        {
            ICASModel cASModel = new CASModelProxy(Responder.Instance.CASModel);

            cASModel.RequestRemoveCASPart(part);

            /*
             * foreach (CASPart part in cASModel.GetWornParts(partType))
             * {
             *  cASModel.RequestRemoveCASPart(part);
             * }
             */
            ths.mCurrentPreset = null;
            ths.UpdateCostumePresetState();
            Audio.StartSound("ui_tertiary_button");
        }
Exemplo n.º 4
0
        public static void SelectItem(CASMakeup ths, CASPart part, CASPartPreset preset, bool allowMultiple)
        {
            ICASModel      cASModel  = new CASModelProxy(Responder.Instance.CASModel);
            List <CASPart> wornParts = cASModel.GetWornParts(part.BodyType);
            bool           flag      = false;

            if ((part.Key == ths.kInvalidCASPart.Key) && (!allowMultiple))
            {
                foreach (CASPart part2 in wornParts)
                {
                    cASModel.RequestRemoveCASPart(part2);
                }
            }
            else if (!wornParts.Contains(part))
            {
                flag = true;
            }

            if (preset != null)
            {
                ths.mCurrentPreset = preset;
                if (preset.mPresetString != null)
                {
                    if (flag)
                    {
                        cASModel.RequestAddCASPart(part, preset.mPresetString);
                    }
                    else
                    {
                        cASModel.RequestCommitPresetToPart(part, preset.mPresetString);
                    }
                }
            }
            else if (flag)
            {
                ths.mCurrentPreset = new CASPartPreset(part, null);

                cASModel.RequestAddCASPart(part, false);
            }

            ths.UpdateCostumePresetState();
            Audio.StartSound("ui_tertiary_button");
        }