Beispiel #1
0
        public async Task <List <PlayerGameItem> > GetEquipments(string itemId)
        {
            var Equipments = new List <PlayerGameItem>();

            if (hasEquipment)
            {
                PlayerGameItem equipment = new PlayerGameItem();
                equipment.GiType     = "AddressableGameItem";
                equipment.GiId       = "AGI_Stick1";
                equipment.Id         = "4";
                equipment.PrefabType = LocalisablePrefabType.InGame;
                equipment.IsActive   = true;
                equipment.SetAttr(PlayerGameItem.ATTRS_SLOTTED, Enum.GetName(typeof(Slot), Slot.RHand));
                Equipments.Add(equipment);

                //Skin
                PlayerGameItem skin = new PlayerGameItem();
                skin.GiType     = "AddressableGameItem";
                skin.GiId       = "AGI_BallFishSkin1";
                skin.Id         = "5";
                skin.PrefabType = LocalisablePrefabType.InGame;
                skin.IsActive   = true;
                skin.SetAttr(PlayerGameItem.ATTRS_SLOTTED, Enum.GetName(typeof(Slot), Slot.Body));

                Equipments.Add(skin);
            }
            hasEquipment = !hasEquipment;
            return(Equipments);
        }
Beispiel #2
0
        public async virtual Task <PlayerGameItem> LoadCurrentScene(string theme)
        {
            PlayerGameItem scene = new PlayerGameItem();

            scene.GiType     = "Level";
            scene.GiId       = "Level_sea1";
            scene.Id         = "1";
            scene.PrefabType = LocalisablePrefabType.InGame;

            //Generate the seaweeds
            scene.Children = GenerateSeaweeds();

            //Generate character
            PlayerGameItem character = new PlayerGameItem();

            character.GiType     = "Character";
            character.GiId       = "Character_Turtle";
            character.Id         = "2";
            character.PrefabType = LocalisablePrefabType.Type1;
            character.SetBoolAttr(PlayerGameItem.ATTRS_IS_PLAYER, true);

            scene.Children.Add(character);

            //Generate character
            character            = new PlayerGameItem();
            character.GiType     = "Character";
            character.GiId       = "Character_BallFish";
            character.Id         = "3";
            character.PrefabType = LocalisablePrefabType.Type1;
            character.IsActive   = false;

            scene.Children.Add(character);

            //Equipment: stick
            PlayerGameItem equipment = new PlayerGameItem();

            equipment.GiType     = "AddressableGameItem";
            equipment.GiId       = "AGI_Stick1";
            equipment.Id         = "4";
            equipment.PrefabType = LocalisablePrefabType.InGame;
            equipment.IsActive   = true;
            equipment.SetAttr(PlayerGameItem.ATTRS_SLOTTED, Enum.GetName(typeof(Slot), Slot.RHand));

            character.Equipments = new List <PlayerGameItem>();
            character.Equipments.Add(equipment);

            //Skin
            PlayerGameItem skin = new PlayerGameItem();

            skin.GiType     = "AddressableGameItem";
            skin.GiId       = "AGI_BallFishSkin1";
            skin.Id         = "5";
            skin.PrefabType = LocalisablePrefabType.InGame;
            skin.IsActive   = true;
            skin.SetAttr(PlayerGameItem.ATTRS_SLOTTED, Enum.GetName(typeof(Slot), Slot.Body));

            character.Equipments.Add(skin);

            //Debug.Log(JsonUtility.ToJson(scene));
            //Debug.Log(JsonConvert.SerializeObject(scene));
            return(scene);
        }