예제 #1
0
        private void SavePlayerCustomisation(int index, PlayerCustomisationData data)
        {
            string key   = GetPrefsKeyForPlayer(index);
            string value = JsonUtility.ToJson(data);

            PlayerPrefs.SetString(key, value);
        }
예제 #2
0
        private void ChangePlayerCustomisationContext(int playerID)
        {
            this.playerID = playerID;

            customisationData = CManager.GetPlayerCustomisation(playerID);
            OnPlayerChange.Invoke(customisationData);
            DragonHelper.SetDragonAsPlayer(customisationData, DemoDragon);

            UpdateUI(playerID);
        }
예제 #3
0
        private PlayerCustomisationData LoadPlayerCustomisation(int index)
        {
            string key   = GetPrefsKeyForPlayer(index);
            string value = PlayerPrefs.GetString(key);

            var data = PlayerCustomisationData.CreateDefault(index);

            JsonUtility.FromJsonOverwrite(value, data);

            return(data);
        }
예제 #4
0
        public static void SetDragonAsPlayer(
            PlayerCustomisationData cData,
            GameObject dragon,
            bool changeColour = true)
        {
            PlayerInput pl = dragon.AddComponent <PlayerInput>();

            pl.leftKey  = cData.LeftButton;
            pl.rightKey = cData.RightButton;

            if (changeColour)
            {
                Palette pal = dragon.GetComponent <Palette>();
                pal.ColourSet = ColourCatalogue.GetColourSet(cData.ColourSetIndex);
            }
        }
예제 #5
0
 public void SetPlayerCustomisation(int i, PlayerCustomisationData data)
 {
     PlayerCustomisations[i] = data;
 }
예제 #6
0
 public void SetContext(PlayerCustomisationData customisationData)
 {
     this.customisationData = customisationData;
     UpdateUIColours(customisationData.ColourSetIndex);
 }
예제 #7
0
 public void SetContext(PlayerCustomisationData customisationData)
 {
     this.customisationData = customisationData;
     leftText.text          = customisationData.LeftButton;
     rightText.text         = customisationData.RightButton;
 }