Пример #1
0
    public virtual void broadcastCustomCharacterProfileCodeSync(
        GameProfileCharacterItem profileCharacterItem = null)
    {
        if (profileCharacterItem == null)
        {
            profileCharacterItem =
                GameProfileCharacters.Current.GetCurrentCharacter();
        }

        if (profileCharacterItem != null)
        {
            Messenger <string> .Broadcast(
                GameCustomMessages.customCharacterPlayerChanged,
                profileCharacterItem.code);
        }
    }
Пример #2
0
    public void loadDataRPG()
    {
        LogUtil.Log("Load RPGs:");

        int i = 0;

        SetUpgradesAvailable(GameProfileRPGs.Current.GetUpgrades());

        profileCharacterItem = GameProfileCharacters.Current.GetCurrentCharacter();

        if (profileCharacterItem != null)
        {
            profileGameDataItemRPG = profileCharacterItem.profileRPGItem;

            LogUtil.Log("profileGameDataItemRPG:attack2:" +
                        profileGameDataItemRPG.GetAttack());

            List <string> rpgItems = new List <string>();

            rpgItems.Add(GameDataItemRPGAttributes.speed);
            rpgItems.Add(GameDataItemRPGAttributes.health);
            rpgItems.Add(GameDataItemRPGAttributes.energy);
            rpgItems.Add(GameDataItemRPGAttributes.attack);
            //rpgItems.Add(GameDataItemRPGAttributes.defense);

            foreach (string rpgItem in rpgItems)
            {
                GameObject item = NGUITools.AddChild(listGridRoot, listItemPrefab);
                item.name = "AItem" + i;

                UICustomizeCharacterRPGItem rpg =
                    item.transform.GetComponent <UICustomizeCharacterRPGItem>();

                if (rpg != null)
                {
                    rpg.Load(rpgItem);
                }

                i++;
            }
        }
    }
    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;
    }
    public void ChangePreset(int index)
    {
        GameProfileCharacterItems gameProfileCharacterItems
            = GameProfileCharacters.Current.GetCharacters();

        int countPresets = gameProfileCharacterItems.items.Count;

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

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

        currentIndex = index;

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

            currentProfileCustomItem = GameProfileCharacters.currentCustom;

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


                //GameCustomController.UpdateTexturePresetObject(
                //    initialProfileCustomItem, currentObject, type);
            }
            else
            {
                profileCharacterItem =
                    gameProfileCharacterItems.items[currentIndex];

                //GameCustomController.SaveCustomItem(currentProfileCustomItem);

                Messenger <string> .Broadcast(
                    GameCustomMessages.customCharacterPlayerChanged, profileCharacterItem.code);

                string        characterType = "";
                GameCharacter gameCharacter = GameCharacters.Instance.GetById(profileCharacterItem.characterCode);
                if (gameCharacter != null)
                {
                    characterType = gameCharacter.display_name;
                    characterType = "- TYPE: " + characterType + " -";
                }

                UIUtil.SetInputValue(inputCurrentDisplayName, profileCharacterItem.characterDisplayName);
                UIUtil.SetLabelValue(labelCurrentDisplayName, profileCharacterItem.characterDisplayName);
                UIUtil.SetLabelValue(labelCurrentType, characterType);

                UIUtil.SetInputValue(inputCurrentDisplayCode, profileCharacterItem.characterDisplayCode);

                UIUtil.SetLabelValue(labelCurrentStatus, string.Format("{0}/{1}", index + 1, countPresets));
            }
        }
    }