Example #1
0
    public void ChangePreset(int index)
    {
        int countPresets =
            AppContentAssetTexturePresets.Instance.GetListByType(type).Count;


        if (index < -1)
        {
            index = countPresets - 1;
        }

        if (index > countPresets - 1)
        {
            index = -1;
        }

        currentIndex = index;

        if (index > -2 && index < countPresets)
        {
            if (initialProfileCustomItem == null)
            {
                initialProfileCustomItem = GameProfileCharacters.currentCustom;
            }

            currentProfileCustomItem = GameProfileCharacters.currentCustom;

            if (index == -1)
            {
                UIUtil.SetLabelValue(labelCurrentDisplayName, "My Previous Uniform");

                GameCustomController.UpdateTexturePresetObject(
                    initialProfileCustomItem, currentObject, type);
            }
            else
            {
                AppContentAssetTexturePreset preset =
                    AppContentAssetTexturePresets.Instance.GetListByType(type)[currentIndex];

                //AppColorPreset presetColor =
                //    AppColorPresets.Instance.GetListByType(type)[currentIndex];

                // change character to currently selected texture preset

                currentProfileCustomItem =
                    GameCustomController.UpdateTexturePresetObject(
                        currentProfileCustomItem, currentObject, preset);

                //profileCustomItem = GameCustomController.UpdateColorPresetObject(profileCustomItem, currentObject, presetColor);

                GameCustomController.SaveCustomItem(currentProfileCustomItem);

                UIUtil.SetLabelValue(labelCurrentDisplayName, preset.display_name);
            }
        }
    }
Example #2
0
    public virtual void OnCustomColorChanged(Color color)
    {
        GameAudio.PlayEffect(GameAudioEffects.audio_effect_ui_button_1);

        currentProfileCustomItem = GameProfileCharacters.currentCustom;

        foreach (AppContentAssetCustomItem customItem
                 in AppContentAssetCustomItems.Instance.GetListByType(type))
        {
            Dictionary <string, Color> colors = new Dictionary <string, Color>();

            foreach (AppContentAssetCustomItemProperty prop in customItem.properties)
            {
                bool update = false;

#if USE_UI_NGUI_2_7 || USE_UI_NGUI_3
                foreach (KeyValuePair <string, UICheckbox> pair in checkboxes)
                {
#else
                foreach (KeyValuePair <string, Toggle> pair in checkboxes)
                {
#endif
                    if (pair.Value == null)
                    {
                        LogUtil.Log("Checkbox not found:" + pair.Key);
                        continue;
                    }

                    if (UIUtil.IsCheckboxChecked(pair.Value) &&//.isChecked
                        prop.code == pair.Key)
                    {
                        update = true;
                    }
                }

                Color colorTo = currentProfileCustomItem.GetCustomColor(prop.code);

                if (update)
                {
                    color.a = 1;
                    colorTo = color;
                }

                colors.Add(prop.code, colorTo);
            }

            currentProfileCustomItem =
                GameCustomController.UpdateColorPresetObject(
                    currentProfileCustomItem, currentObject, type, colors);

            GameCustomController.SaveCustomItem(currentProfileCustomItem);
        }
    }
    public virtual void handleSave()
    {
        lastSave += Time.deltaTime;

        if (lastSave > 1f)
        {
            lastSave = 0;

            if (save)
            {
                save = false;
                GameCustomController.SaveCustomItem();
            }
        }
    }
 public virtual void saveCustomItem()
 {
     GameCustomController.SaveCustomItem(GameProfileCharacters.currentCustom);
 }