Ejemplo n.º 1
0
 public virtual void handlePeriodic()
 {
     if (Time.time > lastPeriodicSeconds + 3f)
     {
         lastPeriodicSeconds = Time.time;
         // every second
         GameCustomController.DirectCustom();
     }
 }
Ejemplo n.º 2
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);
            }
        }
    }
Ejemplo n.º 3
0
    public virtual void saveCustomItem(GameProfileCustomItem profileCustomItem)
    {
        GameProfileCharacters.Current.SetCharacterCustom(profileCustomItem);

        GameState.SaveProfile();

        //LogUtil.Log("saveCustomItem:profileCustomItem:" + profileCustomItem);
        //LogUtil.Log("saveCustomItem:profileCustomItem:json:" + profileCustomItem.ToJson());
        //LogUtil.Log("saveCustomItem:currentCustom:json:" + GameProfileCharacters.currentCustom.ToJson());

        GameCustomController.BroadcastCustomSync();
    }
Ejemplo n.º 4
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);
        }
    }
Ejemplo n.º 5
0
    public void SetCustomTextures()
    {
        CheckData();

        if (customCharacterDataCurrent.lastCustomTextureCode
            == customCharacterData.presetTextureCode)
        {
            //return;
        }

        if (customCharacterData.isCustomType ||
            customCharacterData.isTeamType ||
            customCharacterData.isExplicitType)
        {
            return;
        }
        else if (customCharacterData.isDefaultType)
        {
            if (customCharacterData.actorType == GameCustomActorTypes.heroType)
            {
                GameProfileCustomItem customItem = GameProfileCharacters.currentCustom;

                if (customItem != null)
                {
                    GameCustomController.UpdateTexturePresetObject(
                        customItem,
                        gameObject,
                        customCharacterData.presetType);
                }
                else
                {
                    GameCustomController.UpdateTexturePresetObject(
                        gameObject,
                        AppContentAssetTexturePresets.Instance.GetByCode(
                            customCharacterData.presetTextureCodeDefault));
                }    //GameCustomController.BroadcastCustomColorsChanged
            }
            else
            {
                GameCustomController.UpdateTexturePresetObject(
                    gameObject,
                    AppContentAssetTexturePresets.Instance.GetByCode(
                        customCharacterData.presetTextureCodeDefault));
            }
        }

        customCharacterDataCurrent.lastCustomTextureCode =
            customCharacterData.presetTextureCode;
    }
Ejemplo n.º 6
0
    public virtual void handleSave()
    {
        lastSave += Time.deltaTime;

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

            if (save)
            {
                save = false;
                GameCustomController.SaveCustomItem();
            }
        }
    }
Ejemplo n.º 7
0
    // ------------------------------------------------------------
    // EFFECTS SCORE

    public virtual void PlayEffectsScore()
    {
        if (FPSDisplay.isUnder25FPS)
        {
            return;
        }

        Color colorTo = GameCustomController.GetRandomizedColorFromContextEffects();

        if (containerEffectsScore != null)
        {
            containerEffectsScore.Show();
            containerEffectsScore.SetParticleSystemStartColor(colorTo, true);
            containerEffectsScore.PlayParticleSystem(true);
        }
    }
Ejemplo n.º 8
0
    public virtual void Update()
    {
        if (!runDirector ||
            GameDraggableEditor.isEditing)
        {
            return;
        }

        handleSave();

        if (GameController.IsGameRunning)
        {
            GameCustomController.HandlePeriodic();

            GameCustomController.HandleUpdate();
        }
    }
Ejemplo n.º 9
0
    public void ShowOverview()
    {
        HideStates();

        // Update team display
        //LogUtil.Log("ShowOverview:");

        flowState = AppOverviewFlowState.Mode;

        UIPanelDialogBackground.ShowDefault();

        UpdateOverviewWorld();

        UIUtil.SetLabelValue(labelOverviewType, AppContentStates.Current.display_name);

        AnimateInBottom(containerOverview);

        GameCustomController.BroadcastCustomSync();

        foreach (GameCustomPlayer customPlayer in gameObject.GetList <GameCustomPlayer>())
        {
            if (customPlayer.isActorTypeEnemy)
            {
                GameTeam team = GameTeams.Current;

                if (team != null)
                {
                    UIUtil.SetLabelValue(labelOverviewTeamEnemy, team.display_name);

                    GameCustomCharacterData customInfo = new GameCustomCharacterData();
                    customInfo.actorType         = GameCustomActorTypes.enemyType;
                    customInfo.presetColorCode   = team.data.GetColorPreset().code;
                    customInfo.presetTextureCode = team.data.GetTexturePreset().code;
                    customInfo.type     = GameCustomTypes.teamType;
                    customInfo.teamCode = team.code;

                    customPlayer.Load(customInfo);
                }
            }
        }

        ContentPause();

        UIColors.UpdateColors();
    }
Ejemplo n.º 10
0
    void OnTipsCycleHandler(string objName)
    {
        if (objName != lastTipObjectName)
        {
            lastTipObjectName = objName;

            if (flowState == AppOverviewFlowState.GameplayTips)
            {
                ChangeTipsState(AppOverviewFlowState.Mode);
            }
            else
            {
                ChangeTipsState(AppOverviewFlowState.GameplayTips);
            }
        }

        GameCustomController.BroadcastCustomSync();
    }
Ejemplo n.º 11
0
    public virtual Color getRandomizedColorFromContextEffects()
    {
        // Randomize or get customized colors

        Color colorTo = UIColors.colorWhite;

        int randomColor = UnityEngine.Random.Range(0, 4);

        if (randomColor < 1)
        {
            colorTo = GameCustomController.GetRandomizedColorFromContextCustomized();
        }
        else
        {
            colorTo = GameCustomController.GetRandomizedColorFromContextUI();
        }

        return(colorTo);
    }
Ejemplo n.º 12
0
    public virtual void setCustomColorsPlayer(GameObject go, GameProfileCustomItem customItem)
    {
        GameCustomPlayer player = go.GetComponent <GameCustomPlayer>();

        if (player == null)
        {
            GameCustomPlayer[] players = go.GetComponentsInChildren <GameCustomPlayer>(true);

            foreach (GameCustomPlayer playerTo in players)
            {
                player = playerTo;
                break;
            }
        }

        if (player != null)
        {
            GameCustomController.SetMaterialColors(go, customItem);
        }
    }
Ejemplo n.º 13
0
    public void HandleCustomPlayerDisplayValues()
    {
        CheckData();

        if (customCharacterData.isCustomType ||
            customCharacterData.isDefaultType)
        {
            if (customCharacterDataCurrent.lastCustomDisplayCode
                != customCharacterData.characterDisplayCode ||
                customCharacterDataCurrent.lastCustomDisplayName
                != customCharacterData.characterDisplayName)
            {
                GameCustomController.UpdateCharacterDisplay(
                    gameObject,
                    customCharacterData.characterDisplayName,
                    customCharacterData.characterDisplayCode);

                customCharacterDataCurrent.lastCustomDisplayCode = customCharacterData.characterDisplayCode;
                customCharacterDataCurrent.lastCustomDisplayName = customCharacterData.characterDisplayName;
            }
        }
    }
Ejemplo n.º 14
0
    public virtual void updateProfileCharacterDisplayCode(GameObject go)
    {
        string val = GameProfileCharacters.currentCharacter.characterDisplayCode;

        GameCustomController.UpdateCharacterDisplayCode(go, val);
    }
Ejemplo n.º 15
0
    public virtual void Change(GameCustomCharacterData customCharacterDataTo)
    {
        customCharacterData = customCharacterDataTo;
        //customCharacterDataCurrent = customCharacterDataTo;

        CheckData();

        if (gameCustomPlayerContainer != null)
        {
            gameCustomPlayerContainer.customCharacterData = customCharacterData;
        }

        //LogUtil.Log("GameCustomBase:Change:characterData:" + characterData.teamCode);

        if (customCharacterData != null)
        {
            //customCharacterData.presetColorCode = customCharacterData.presetColorCode;
            //customCharacterData.presetTextureCode = customCharacterData.presetTextureCode;

            //LogUtil.Log("GameCustomBase:Change:customColorCode:" + customColorCode);
            //LogUtil.Log("GameCustomBase:Change:customTextureCode:" + customTextureCode);

            if (!string.IsNullOrEmpty(customCharacterData.teamCode) &&
                customCharacterData.teamCode != "default")
            {
                //LogUtil.Log("Loading TEAM Custom Type:characterData.teamCode:" + characterData.teamCode);

                GameTeam team = GameTeams.Instance.GetById(customCharacterData.teamCode);

                if (team != null)
                {
                    if (team.data != null)
                    {
                        customCharacterData.teamCode = team.code;
                        customCharacterData.type     = GameCustomTypes.teamType;

                        //LogUtil.Log("Loading TEAM EXISTS Type:teamCode:" + teamCode);

                        GameDataTexturePreset itemTexture = team.data.GetTexturePreset();

                        if (itemTexture != null)
                        {
                            customCharacterData.presetTextureCode          = itemTexture.code;
                            customCharacterDataCurrent.lastCustomColorCode = "--";
                        }

                        GameDataColorPreset itemColor = team.data.GetColorPreset();

                        if (itemColor != null)
                        {
                            customCharacterData.presetColorCode = itemColor.code;
                            customCharacterDataCurrent.lastCustomTextureCode = "--";
                        }
                    }

                    GameCustomController.UpdateCharacterDisplay(
                        gameObject,
                        team.display_name,
                        UnityEngine.Random.Range(1, 99).ToString());
                }
            }
        }

        UpdatePlayer();
    }
Ejemplo n.º 16
0
    public void SetCustomColors()
    {
        CheckData();

        if (customCharacterDataCurrent.lastCustomColorCode
            == customCharacterData.presetColorCode)
        {
            //return;
        }

        //LogUtil.Log("SetCustomColors"
        //          + " type:" + characterData.type
        //          + " presetType:" + characterData.presetType
        //          + " presetColorCode:" + characterData.presetColorCode
        //          + " presetTextureCode:" + characterData.presetTextureCode);


        if (customCharacterData.isCustomType ||
            customCharacterData.isTeamType ||
            customCharacterData.isExplicitType)
        {
            return;
        }
        else if (customCharacterData.isDefaultType)
        {
            if (customCharacterData.actorType == GameCustomActorTypes.heroType)
            {
                GameProfileCustomItem customItem = GameProfileCharacters.currentCustom;

                //LogUtil.Log("SetCustomColors"
                //         + " customItem:" + customItem.ToJson());

                if (customItem != null)
                {
                    if (!customItem.HasData())
                    {
                        GameCustomController.UpdateColorPresetObject(
                            gameObject,
                            AppColorPresets.Instance.GetByCode(
                                customCharacterData.presetColorCodeDefault));
                    }
                    else
                    {
                        //customItem = GameCustomController.FillDefaultCustomColors(customItem, type);

                        GameCustomController.UpdateColorPresetObject(
                            customItem,
                            gameObject,
                            customCharacterData.presetType);
                    }
                }
                else
                {
                    GameCustomController.UpdateColorPresetObject(
                        gameObject,
                        AppColorPresets.Instance.GetByCode(
                            customCharacterData.presetColorCodeDefault));
                }//GameCustomController.BroadcastCustomColorsChanged
            }
            else
            {
                GameCustomController.UpdateColorPresetObject(
                    gameObject,
                    AppColorPresets.Instance.GetByCode(
                        customCharacterData.presetColorCodeDefault));
            }//GameCustomController.BroadcastCustomColorsChanged
        }

        customCharacterDataCurrent.lastCustomColorCode =
            customCharacterData.presetColorCode;
    }
Ejemplo n.º 17
0
 public virtual void saveCustomItem()
 {
     GameCustomController.SaveCustomItem(GameProfileCharacters.currentCustom);
 }
Ejemplo n.º 18
0
    public virtual void Init()
    {
        colorPresets = new GameProfileCustomPresets();

        GameCustomController.LoadCustomColors();
    }
Ejemplo n.º 19
0
    public virtual void setCustomColorsPlayer(GameObject go)
    {
        GameProfileCustomItem customItem = GameProfileCharacters.currentCustom;

        GameCustomController.SetCustomColorsPlayer(go, customItem);
    }
Ejemplo n.º 20
0
    // ANY CHARACTER

    public virtual void updateCharacterDisplay(GameObject go, string valName, string valCode)
    {
        GameCustomController.UpdateCharacterDisplayName(go, valName);
        GameCustomController.UpdateCharacterDisplayCode(go, valCode);
    }
    public void LoadPlayer(string characterCodeTo)
    {
        if (string.IsNullOrEmpty(characterCodeTo))
        {
            return;
        }

        customCharacterData.characterCode = characterCodeTo;

        if (containerPlayerDisplay == null)
        {
            return;
        }

        string gameCharacterCode = customCharacterData.characterCode;

        if (isProfileCharacterCode)
        {
            GameProfileCharacterItem gameProfileCharacterItem =
                GameProfileCharacters.Current.GetCharacter(
                    customCharacterData.characterCode);

            if (gameProfileCharacterItem == null)
            {
                return;
            }

            gameCharacterCode = gameProfileCharacterItem.characterCode;
        }

        GameCharacter gameCharacter =
            GameCharacters.Instance.GetById(gameCharacterCode);

        if (gameCharacter == null)
        {
            return;
        }

        containerPlayerDisplay.DestroyChildren();

        GameObject go = gameCharacter.Load();

        if (go == null)
        {
            return;
        }

        go.transform.parent        = containerPlayerDisplay.transform;
        go.transform.position      = Vector3.zero;
        go.transform.localPosition = Vector3.zero;
        go.transform.localScale    = Vector3.one;
        go.transform.localRotation = Quaternion.identity;//.Euler(Vector3.zero.WithY(133));

        //GameController.CurrentGamePlayerController.LoadCharacter(gameCharacter.data.GetModel().code);

        go.SetLayerRecursively(gameObject.layer);

        // LOAD UP PASSED IN VALUES

        customPlayerObject = go.GetOrSet <GameCustomPlayer>();

        if (customPlayerObject != null)
        {
            customPlayerObject.Change(customCharacterData);
        }

        GameCustomController.BroadcastCustomSync();

        if (containerRotator != null)
        {
            containerRotator.ResetObject();
        }
    }
    public void LoadPlayer(string characterCodeTo, bool isProfileCharacter = false)
    {
        isProfileCharacterCode = isProfileCharacter;

        if (string.IsNullOrEmpty(characterCodeTo))
        {
            return;
        }

        if (customCharacterData.characterCode == characterCodeTo &&
            initialized)
        {
            return;
        }

        customCharacterData.characterCode = characterCodeTo;

        if (containerPlayerDisplay == null)
        {
            return;
        }

        string gameCharacterCode = customCharacterData.characterCode;

        if (isProfileCharacterCode)
        {
            // If this is a profile code or profile uuid character code
            // look it up in teh profile and get the model name there.

            gameProfileCharacterItem =
                GameProfileCharacters.Current.GetCharacter(
                    customCharacterData.characterCode);

            if (gameProfileCharacterItem == null)
            {
                return;
            }

            // TODO REMOVE and make sure initial sets correctly.

            if (gameProfileCharacterItem.code == BaseDataObjectKeys.defaultKey)
            {
                gameCharacterCode = ProfileConfigs.defaultProfileCharacterCode;
            }
            else
            {
                gameCharacterCode = gameProfileCharacterItem.characterCode;
            }
        }

        GameCharacter gameCharacter =
            GameCharacters.Instance.GetById(gameCharacterCode);

        if (gameCharacter == null)
        {
            return;
        }

        containerPlayerDisplay.DestroyChildren();

        GameObject go = gameCharacter.Load();

        if (go == null)
        {
            return;
        }

        go.transform.parent        = containerPlayerDisplay.transform;
        go.transform.position      = Vector3.zero;
        go.transform.localPosition = Vector3.zero;
        go.transform.localScale    = Vector3.one;
        go.transform.localRotation = Quaternion.identity;//.Euler(Vector3.zero.WithY(133));

        //GameController.CurrentGamePlayerController.LoadCharacter(gameCharacter.data.GetModel().code);

        go.SetLayerRecursively(gameObject.layer);

        // LOAD UP PASSED IN VALUES

        customPlayerObject = go.GetOrSet <GameCustomPlayer>();

        if (customPlayerObject != null)
        {
            customPlayerObject.Change(customCharacterData);
        }

        GameCustomController.BroadcastCustomSync();

        if (containerRotator != null)
        {
            containerRotator.ResetObject();
        }

        initialized = true;
    }