/// <summary>
    /// Initialize the bank inventory for the test scene
    /// </summary>
    private void InitTestBank()
    {
        PlayerBag inv = new PlayerBag(InventorySize);

        //Do some basic operations to check for errors
        inv.Add(0, 2);
        inv.Add(0, 1);
        inv.Add(1, 1);
        inv.Add(0, 5);
        inv.Add(1, 2);

        inv.Remove(1, 2);
        inv.Remove(0, 6);

        inv.Add(2, 1);
        inv.Add(3, 1);
        inv.Add(4, 1);
        inv.Add(5, 1);
        inv.Add(6, 1);
        inv.Add(7, 1);

        //Display some basic info to check for errors
        Debug.Log($"Amount Apple : { inv.GetAmount(0)}");
        Debug.Log($"Amount Bread : { inv.GetAmount(1)}");
        Debug.Log($"Capacity Apple : { inv.GetFreeSpace(0)}");
        Debug.Log($"Capacity Bread : { inv.GetFreeSpace(1)}");

        Bank.Initialize(inv);
    }
Example #2
0
    /// <summary> 获取某道具持有数量 </summary>
    static public uint GetItemCount(int ItemID)
    {
        if (GameApp.Instance.PlayerData != null)
        {
            PlayerBag pb  = GameApp.Instance.PlayerData.m_player_bag;
            uint      cnt = 0;
            for (int i = 0; i < pb.m_items.Count; i++)
            {
                if (pb.m_items[i].m_item_id == ItemID)
                {
                    cnt += pb.m_items[i].m_item_count;
                }
            }
            return(cnt);
        }
        else
        {
            if (CsvConfigTables.Instance.MagicCardCsvDic.ContainsKey(ItemID))
            {
                return((uint)GameApp.Instance.CardHoldCountLst[ItemID]);
            }
        }

        return(0);
    }
Example #3
0
    private void Awake()
    {
        _equip = new PlayerEquipment();
        _bag   = new PlayerBag();

        _view = GetComponentInChildren <InventoryView>();
    }
Example #4
0
    public Orb DrawPlayerBag()
    {
        Orb drawnOrb = PlayerBag.DrawOrb();

        PlayerDrawOrbEvent?.Invoke(drawnOrb);
        return(drawnOrb);
    }
Example #5
0
    public void Init(PlayerBag _bag)
    {
        if (_bag == null)
        {
            m_bagPB = new PlayerBag();
        }
        else
        {
            m_bagPB = _bag;
        }
        Debug.Log("start init bag");
        baseBag     = new uint[30];
        equipBag    = new uint[10];
        moneyBag    = new uint [4];
        m_baseItems = new Dictionary <uint, BaseItem>();
        int i = 0;

        foreach (ItemInfo item in m_bagPB.Items)
        {
            Debug.Log("item id = " + item.MItemid);
            m_baseItems.Add(item.MItemid, ItemFactory.Instance.CreateItem(item));

            baseBag[i++] = item.MItemid; // 先全放在基础背包里,装备 和 金币 背包 还需要在 protobuf 里增加字段
        }
        m_itemevent = new ItemEvent();

        EventHandler.Instance.AddHandle(EventType.ITEM, ItemUpdate);
    }
Example #6
0
    void OnAddMoneyClick()
    {
        if (GameSetting.enableConsole != true)
        {
            return;
        }
        int money = 0;

        try
        {
            money = Int32.Parse(moneyInput.text);
        }
        catch
        {
            money = 0;
        }

        LocalPlayer localPlayer = Helper.FindLocalPlayer();

        if (localPlayer != null)
        {
            //获取背包
            PlayerBag playerBag = localPlayer.bag;
            playerBag.money += money;
        }
    }
Example #7
0
    public void Initialization(PlayerBag bag)
    {
        int bagCapacity   = bag.items.Capacity;
        int bagItemsCount = bag.items.Count;

        for (int i = 0; i < bagCapacity; i++)
        {
            GameObject  item        = Instantiate(_itemPrefab, _content);
            BagItemView view        = item.GetComponent <BagItemView>();
            bool        noMoreItems = i >= bagItemsCount;

            _items.Add(view);

            if (noMoreItems)
            {
                Item empty = ScriptableObject.CreateInstance <Item>();
                view.SetItem(empty, out _);
                continue;
            }

            view.SetItem(bag.items[i], out _);
            view.OnEquipItem  += bag.Add;
            view.OnRemoveItem += bag.Remove;
        }
    }
Example #8
0
    private void OnEnable()
    {
        PlayerHealth = GetComponent <Health>();
        PlayerBag    = GetComponent <PlayerBag>();

        OnContact.CaptureAction += OnCreatureCaptured;
    }
Example #9
0
 void UnbindBag()
 {
     if (bindBag != null)
     {
         bindBag.itemPack.PackChangedEvent -= this.OnPackChanged;
         bindBag = null;
     }
 }
Example #10
0
    private void LoadPlayerBag()
    {
        string json = File.ReadAllText(_filePath);

        PlayerBag = JsonUtility.FromJson <Bag>(json);
        PlayerBag.SetupOrbInfo(context);
        PlayerBag.SetupWeightTable();
    }
    /// <summary>
    /// Initialize the player inventory for the test scene
    /// </summary>
    private void InitTestInventory()
    {
        PlayerBag inv = new PlayerBag(InventorySize);

        inv.Add(0, 2);
        inv.Add(4, 1);

        Inventory.Initialize(inv);
    }
Example #12
0
 public void NewGame()
 {
     stats      = new PlayerStats(energyCosts, cashText, batteryText, batteryBar);
     controller = new PlayerController();
     bag        = new PlayerBag(bagUI, maxBagCapacity);
     inventory  = new PlayerInventory(inventoryUI);
     movement   = new PlayerMovement(playerAnimations);
     equipment  = new PlayerEquipment(upgradeBag, upgradeHelmet, upgradePickaxe);
 }
Example #13
0
    public bool MeetsRequirementsForPlayer(Spell spell)
    {
        if (spell.MeetsRequirements())
        {
            return(PlayerBag.BagMeetsRequirements(spell.OrbRequirements));
        }

        return(false);
    }
Example #14
0
 private void Awake()
 {
     m_playerinfo = new PlayerInfo(Random.Range(1, 1000000));
     m_playerbag  = new PlayerBag();
     PlayerMgr.singleton.RegistePlayerSelf(this);
     p_cc       = GetComponent <CharacterController>();
     player     = GameObject.Find("Player_warrior");
     p_animator = player.transform.GetComponent <Animator>();
 }
Example #15
0
 void BindBag(PlayerBag bag)
 {
     //先解绑
     UnbindBag();
     if (bag == null)
     {
         return;
     }
     //绑定到新的package
     bindBag = bag;
     //暂时没考虑背包关闭的问题
     bindBag.itemPack.PackChangedEvent += this.OnBagChanged; //item包改变
 }
Example #16
0
    //点下物品格
    void OnItemMouseDown(UIItemSlot slot, PointerEventData eventData)
    {
        LocalPlayer player = Helper.FindLocalPlayer();

        if (player != null)
        {
            PlayerBag bag = player.bag;
            if (eventData.button == PointerEventData.InputButton.Right)
            { //点击右键购买
            }
        }

        Helper.MoveWndToFront(transform);
    }
Example #17
0
    IEnumerator RefreshPresentList()
    {
        MyTools.DestroyImmediateChildNodes(PresentGrid.transform);
        UIScrollView sv = PresentGrid.transform.parent.GetComponent <UIScrollView>();

        PlayerBag pb = GameApp.Instance.PlayerData.m_player_bag;

        for (int i = 0, p = 0; i < pb.m_items.Count; i++)
        {
            ItemConfig ItemCfg = null;
            CsvConfigTables.Instance.ItemCsvDic.TryGetValue((int)pb.m_items[i].m_item_id, out ItemCfg);
            if (ItemCfg != null)
            {
                if (ItemCfg.Type == 13)
                {
                    GameObject newUnit = NGUITools.AddChild(PresentGrid.gameObject, PresentUnitPrefab);
                    newUnit.SetActive(true);
                    newUnit.name = "PresentUnit_" + p;
                    int x = 0;
                    if (p % 3 == 0)
                    {
                        x = 0;
                    }
                    else if (p % 3 == 1)
                    {
                        x = 160;
                    }
                    else if (p % 3 == 2)
                    {
                        x = 320;
                    }
                    newUnit.transform.localPosition = new Vector3(x, -160 * (p / 3), 0);

                    UI_Travel_Present_PresentUnit fu = newUnit.GetComponent <UI_Travel_Present_PresentUnit>();
                    fu.SetPresentData(ItemCfg.ItemID);

                    PresentGrid.repositionNow = true;
                    sv.ResetPosition();

                    yield return(new WaitForEndOfFrame());

                    p++;
                }
            }
        }

        PresentGrid.repositionNow = true;
        sv.ResetPosition();
    }
    IEnumerator RefreshItemList(ETravelBackpackItemType TBIType)
    {
        List <ulong> IDLst = new List <ulong>();

        for (int i = 0; i < CurTypeGrids.Count; i++)
        {
            for (int j = 0; j < CurTypeGrids[i].transform.childCount; j++)
            {
                Transform child = CurTypeGrids[i].transform.GetChild(j);
                if (child.name.Contains("GridInfo_"))
                {
                    IDLst.Add(ulong.Parse(MyTools.GetLastString(child.name, '_')));
                }
            }
        }

        MyTools.DestroyImmediateChildNodes(ItemGrid.transform);
        UIScrollView sv = ItemGrid.transform.parent.GetComponent <UIScrollView>();

        if (GameApp.Instance.PlayerData != null)
        {
            PlayerBag pb = GameApp.Instance.PlayerData.m_player_bag;
            for (int i = 0, p = 0; i < pb.m_items.Count; i++)
            {
                ItemConfig ItemCfg = null;
                CsvConfigTables.Instance.ItemCsvDic.TryGetValue((int)pb.m_items[i].m_item_id, out ItemCfg);
                if (ItemCfg != null)
                {
                    if (ItemCfg.Type == 10 + (int)TBIType)
                    {
                        GameObject newUnit = NGUITools.AddChild(ItemGrid.gameObject, ItemUnitPrefab);
                        newUnit.SetActive(true);
                        newUnit.name = "ItemUnit_" + p;
                        newUnit.transform.localPosition = new Vector3(0, -150 * p / 3, 0);

                        UI_Travel_Backpack_ItemUnit iu = newUnit.GetComponent <UI_Travel_Backpack_ItemUnit>();
                        iu.SetItemData(pb.m_items[i], ItemCfg, IDLst);

                        ItemGrid.repositionNow = true;
                        sv.ResetPosition();

                        yield return(new WaitForEndOfFrame());

                        p++;
                    }
                }
            }
        }
    }
Example #19
0
        public void DropItem(string input)
        {
            var query = PlayerBag.Where(i => i.ItemName == input)
                        .Select(d => d).ToList();

            if (query[0] != null)
            {
                Console.WriteLine("Dropped " + query[0].ItemName + " in the room.");
                PlayerBag.Remove(query[0]);
                PresentLocation.RoomInventory.Add(query[0]);
            }
            else if (query[0] == null)
            {
                Console.WriteLine("Sorry, there is nothing to drop.");
            }
        }
Example #20
0
        public void Take(string input)
        {
            var query = PresentLocation.RoomInventory.Where(i => i.ItemName == input)
                        .Select(d => d).ToList();

            if (query[0] != null)
            {
                Console.WriteLine(query[0].ItemName + " taken.");
                PlayerBag.Add(query[0]);  //lägger till item i Playerbag o tar bort från Roominventory
                PresentLocation.RoomInventory.Remove(query[0]);
            }
            else if (query[0] == null)
            {
                Console.WriteLine("Sorry, there is no " + input + " in this room.");
            }
        }
Example #21
0
 private void Start()
 {
     combat             = Combat.instance;
     evolveManager      = EvolveManager.instance;
     pBag               = PlayerBag.instance;
     attackLearnManager = AttackLearnManager.instance;
     tInspect           = TeamInspect.instance;
     rCombat            = RandomCombatManager.instance;
     pcManager          = PCManager.instance;
     pTeam              = PlayerTeamManager.instance;
     pause              = PauseManager.instance;
     combatUI           = CombatUI.instance;
     cManager           = ConversationManager.instance;
     pMovement          = FindObjectOfType <PlayerMovement>();
     interaction        = FindObjectOfType <Interaction>();
 }
Example #22
0
    /// <summary> 服务器的道具流水ID对应的道具配置表ID </summary>
    static public int SerIDToItemID(ulong ID)
    {
        if (GameApp.Instance.PlayerData != null)
        {
            PlayerBag pb = GameApp.Instance.PlayerData.m_player_bag;
            for (int i = 0; i < pb.m_items.Count; i++)
            {
                if (pb.m_items[i].m_id == ID)
                {
                    return((int)pb.m_items[i].m_item_id);
                }
            }
        }

        return(0);
    }
Example #23
0
    void OnAddItemClick()
    {
        if (GameSetting.enableConsole != true)
        {
            return;
        }
        int  intId  = -1;
        uint amount = 0;

        try
        {
            intId = Int32.Parse(itemId.text);
        }
        catch
        {
            intId = -1;
        }
        try
        {
            amount = UInt32.Parse(itemAmount.text);
        }
        catch
        {
            amount = 1;
        }

        if (amount == 0)
        {
        }
        else
        {
            int  id      = intId;
            Item newItem = new Item(id, amount);
            if (newItem.valid)
            {
                LocalPlayer localPlayer = Helper.FindLocalPlayer();
                if (localPlayer != null)
                {
                    //获取背包
                    PlayerBag   playerBag = localPlayer.bag;
                    ItemPackage pack      = playerBag.itemPack; //获取背包内容
                    pack.PickUpItem(newItem);                   //捡起物品
                }
            }
        }
    }
Example #24
0
        public void Use(string input)
        {
            string text = input;

            string[] inputs = text.Split(' ');


            var query = PlayerBag.Where(i => i.ItemName.Equals(inputs[1]))
                        .Select(d => d).ToList();

            if (query[0].ItemName == "KEY")
            {
                PresentLocation.FindDoor(PresentLocation);
            }
            if (query[0].ItemName != "KEY")
            {
                Console.WriteLine("Sorry you need to find the key first");
            }
        }
Example #25
0
    /// <summary> 获取所有卡牌持有数量 </summary>
    static public uint GetCardCount()
    {
        uint cnt = 0;

        if (GameApp.Instance.PlayerData != null)
        {
            PlayerBag pb = GameApp.Instance.PlayerData.m_player_bag;
            for (int i = 0; i < pb.m_items.Count; i++)
            {
                MagicCardConfig CardCfg = null;
                CsvConfigTables.Instance.MagicCardCsvDic.TryGetValue((int)pb.m_items[i].m_item_id, out CardCfg);
                if (CardCfg != null)
                {
                    cnt += pb.m_items[i].m_item_count;
                }
            }
        }

        return(cnt);
    }
    void OnCollisionEnter2D(Collision2D collision)
    {
        PlayerBag playerBag = collision.gameObject.GetComponent <PlayerBag>();

        if (playerBag != null)
        {
            playerBag.DropPeca(transform, 5f, true);
            GameObject hitCreated = Instantiate(HitPrefab, playerBag.transform) as GameObject;
            hitCreated.transform.localPosition = new Vector3(0f, .5f, 0f);
        }
        else
        {
            if (SplashPrefab != null)
            {
                Vector2 normal = collision.contacts[0].normal;
                float   angle  = Mathf.Atan2(normal.y, normal.x) * Mathf.Rad2Deg;
                Instantiate(SplashPrefab, transform.position, Quaternion.Euler(0f, 0f, angle - 90f));
            }
        }
        Destroy(this.gameObject);
    }
Example #27
0
    public void Awake()
    {
        m_playerinfo = new PlayerInfo(UnityEngine.Random.Range(1, 1000000));

        m_playerbag = new PlayerBag();

        //p_cc = GetComponent<CharacterController>();
        player     = GameObject.Find("Player_warrior");
        p_cc       = player.GetComponent <CharacterController>();
        p_animator = player.transform.GetComponent <Animator>();

        m_skillbtn1 = GameObject.Find("/Canvas/Skill1").GetComponent <Button>();
        m_skillbtn2 = GameObject.Find("/Canvas/Skill2").GetComponent <Button>();
        if (m_skillbtn1 == null)
        {
            Debug.LogError("m_skillbtn1 is null");
        }
        if (m_skillbtn2 == null)
        {
            Debug.LogError("m_skillbtn2 is null");
        }
        m_skillbtn1.onClick.AddListener(OnClickSkill);
        m_skillbtn2.onClick.AddListener(OnClickSkill2);
        PlayerMgr.singleton.RegistePlayerSelf(this, m_playerinfo.uid, (Int32)(player.transform.rotation.y * 100000), (Int32)(player.transform.position.x * 100000), (Int32)(player.transform.position.z * 100000));

        camera = GameObject.Find("Main Camera");
        if (camera == null)
        {
            Debug.Log("camera  is   null");
        }

        cameraPosition = new Vector3(0, 0, 0);
        //放置相机的位置
        camera.transform.position = player.transform.position - player.transform.forward * cameraDistance;
        camera.transform.LookAt(player.transform.position);
        cameraPosition.x          = camera.transform.position.x;
        cameraPosition.y          = camera.transform.position.y + cameraHight;
        cameraPosition.z          = camera.transform.position.z;
        camera.transform.position = cameraPosition;
    }
Example #28
0
    void Start()
    {
        playerState = PlayerState._instance;
        playerBag = playerState.GetPlayerBag();
        isShowPanel = false;
        //equepInfo = plyerState.getPlayerEquep();

        dictionaryUIBagItem = new Dictionary<int, GameObject>();
        dictionaryEquep = new Dictionary<ItemType, ItemInfo>();

        mainControllerUI = GameObject.FindGameObjectWithTag(Tags.UIRoot).GetComponent<UIController>();

        containBagGrid = transform.Find("BagBG").Find("Scroll View").Find("Items").gameObject;
        containEqueps = transform.Find("EquepBG").gameObject;
        containEquepInfo = transform.Find("ItemInfoPanel").Find("ItemInfoBG").gameObject;
        containShop = transform.Find("ShopBG").gameObject;

        containState = containEqueps.transform.Find("StateBG");


        HPstate = containState.Find("LabelHPstate").GetComponent<UILabel>();
        STRstate = containState.Find("LabelSTRstate").GetComponent<UILabel>();
        DEXstate = containState.Find("LabelDEXstate").GetComponent<UILabel>();
        INTstate = containState.Find("LabelINTstate").GetComponent<UILabel>();
        Energystate = containState.Find("LabelEnergystate").GetComponent<UILabel>();
        EXPstate = containState.Find("LabelEXPstate").GetComponent<UILabel>();
        ATKstate = containState.Find("LabelATKstate").GetComponent<UILabel>();
        DEFstate = containState.Find("LabelDEFstate").GetComponent<UILabel>();
        CONstate = containState.Find("LabelCONstate").GetComponent<UILabel>();
        Moneystate = transform.Find("BagBG").Find("LabelMoney").GetComponent<UILabel>();
        shopManagerUI = containShop.GetComponent<UIShopManager>();

        playerState.OnPlayerStateChanged += OnStatesChanged;
        gameObject.SetActive(false);

        containEquepInfo.SetActive(false);
    }
Example #29
0
    void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
            DontDestroyOnLoad(this.gameObject);
            this.gameObject.tag = "DontDestroyObject";
            _mapBagToFliter     = new Dictionary <int, int> {
            };

            _myItems = SplitDataFromServe._listEquipmentInBag;
            //Loading data bag

            //fake items;

            ActionSortBag();

            _AddItemToBagEventRef = (param) => AddItemToBag((EquipmentItem)param);
            this.RegisterListener(EventID.AddItemToBag, _AddItemToBagEventRef);
            _RemoveItemToBagEventRef = (param) => RemoveItemToBag((EquipmentItem)param);
            this.RegisterListener(EventID.RemoveItemToBag, _RemoveItemToBagEventRef);
        }
        //else DestroyObject(this.gameObject);
    }
        /// <summary>
        /// Ucitavamo save iz zadane putanje
        /// </summary>
        /// <param name="path">Putanja do save filea</param>
        private void LoadSaveFile(string path)
        {
            this.player           = new Player();
            this.playerBag        = new PlayerBag(pokemonVersion);
            this.pokemonStorage   = new PokemonStorage();
            this.pokedex          = new Pokedex();
            this.pokemonSave      = new PokemonSave(path);
            isReady               = false;
            uxNationalDex.Checked = false;

            //File je ucitan i spreman za obradu
            if (pokemonSave.isLoaded)
            {
                using (MemoryStream tempSave = new MemoryStream(pokemonSave.saveBank))
                {
                    using (BinaryReader br = new BinaryReader(tempSave))
                    {
                        // Za svaki slucaj postavit na pocetak
                        br.BaseStream.Seek(0, SeekOrigin.Begin);
                        #region Player
                        //Name
                        player.Name = br.ReadBytes(7);
                        //Gender
                        br.BaseStream.Seek(PokemonConstants.playerGenderOffset, SeekOrigin.Begin);
                        player.Gender = br.ReadByte();
                        //TrainerID
                        br.BaseStream.Seek(PokemonConstants.playerTrainerIDOffset, SeekOrigin.Begin);
                        player.TrainerID = br.ReadUInt32();

                        //EncryptionKey
                        if (pokemonVersion == PokemonVersion.Emerald)
                        {
                            br.BaseStream.Seek(PokemonConstants.playerEncryptionKeyOffset, SeekOrigin.Begin);
                            player.EncryptionKey = br.ReadUInt32();
                        }
                        else if (pokemonVersion == PokemonVersion.FireRedAndLeafGreen)
                        {
                            br.BaseStream.Seek(PokemonConstants.playerEncryptionKeyOffsetFireLeaf, SeekOrigin.Begin);
                            player.EncryptionKey = br.ReadUInt32();
                        }
                        else //Ruby, Sapphire
                        {
                            player.EncryptionKey = 0;
                        }
                        //Money and Coins
                        if (pokemonVersion == PokemonVersion.FireRedAndLeafGreen)
                        {
                            //Money
                            br.BaseStream.Seek(PokemonConstants.playerMoneyOffsetFireLeaf, SeekOrigin.Begin);
                            player.Money = br.ReadUInt32();
                            //Coins
                            br.BaseStream.Seek(PokemonConstants.playerCoinsOffsetFireLeaf, SeekOrigin.Begin);
                            player.Coins = br.ReadUInt16();
                        }
                        else //Emerald , Ruby, Sapphire
                        {
                            //Money
                            br.BaseStream.Seek(PokemonConstants.playerMoneyOffset, SeekOrigin.Begin);
                            player.Money = br.ReadUInt32();
                            //Coins
                            br.BaseStream.Seek(PokemonConstants.playerCoinsOffset, SeekOrigin.Begin);
                            player.Coins = br.ReadUInt16();
                        }

                        #endregion
                        #region Items - Bag
                        //Bag
                        if (pokemonVersion == PokemonVersion.FireRedAndLeafGreen)
                        {
                            br.BaseStream.Seek(PokemonConstants.bagOffsetFireLeaf, SeekOrigin.Begin);
                            playerBag.Load(br.ReadBytes(PokemonConstants.bagSizeinBytes));
                        }
                        else if (pokemonVersion == PokemonVersion.RubyAndSapphire)
                        {
                            br.BaseStream.Seek(PokemonConstants.bagOffset, SeekOrigin.Begin);
                            playerBag.Load(br.ReadBytes(PokemonConstants.bagSizeinBytesRubySapphire));
                        }
                        else//Emerald
                        {
                            br.BaseStream.Seek(PokemonConstants.bagOffset, SeekOrigin.Begin);
                            playerBag.Load(br.ReadBytes(PokemonConstants.bagSizeinBytes));
                        }
                        #endregion
                        //Pokemon Storage
                        br.BaseStream.Seek(PokemonConstants.pokemonStorageOffset, SeekOrigin.Begin);
                        pokemonStorage.Load(br.ReadBytes(PokemonConstants.pokemonStorageSize));

                        #region Pokedex
                        //Own
                        br.BaseStream.Seek(PokemonConstants.pokedexOwnOffset, SeekOrigin.Begin);
                        pokedex.LoadOwn(br.ReadBytes(49));
                        //Seen
                        br.BaseStream.Seek(PokemonConstants.pokedexSeenOffset, SeekOrigin.Begin);
                        pokedex.LoadSeen(br.ReadBytes(49));
                        #endregion
                    }
                }//end memory stream
                //Postavljamo enkripcijski kljuc u Items
                Item.EncryptionKey = player.EncryptionKeySmall;
                isReady            = true;
            }//end if
        }
Example #31
0
    //基礎statusを導入
    public void LoadData()
    {
        //TODO: ファイルから数値を読み取る

        #region Tempデータ
        PlayerStateData data = GameController._instance.LoadPlayerState();

        EXP = data.EXP;
        baseSTR = data.BaseSTR;
        baseDEX = data.BaseDEX;
        baseINT = data.BaseINT;
        baseCON = data.BaseCON;
        baseLUK = data.BaseLUK;
        money = data.Money;
        isWalk = data.IsWalk;
        #endregion
        playerActionNow = PlayerAction.Free;
        this.bag = PlayerBag.nowPlayerBag;
        this.equep = PlayerEquep.nowPlayerEquep;
        this.quest = PlayerQuest.nowPlayerQuest;

    }
Example #32
0
 private void Start()
 {
     playerEquipment = Player.Instance.equipment;
     playerBag       = Player.Instance.bag;
     currentUpgrades = GetListOfCurrentlUpgrades();
 }
Example #33
0
    /// <summary>
    /// 初期とバッグ内容変更の時使用
    /// </summary>
    private void updateBag()
    {
        playerBag = PlayerState._instance.GetPlayerBag();
        for (int i = 1; i <= dictionaryUIBagItem.Count; i++)
        {
            dictionaryUIBagItem.TryGetValue(i, out go);
            NGUITools.Destroy(go);
        }

        dictionaryUIBagItem.Clear();
        int j = 1;
        foreach (KeyValuePair<int, Item> item in playerBag.dictionBag)
        {
            if (item.Value.isEqueped)
            {
                go = NGUITools.AddChild(containBagGrid, prefabItemE);
            }
            else if (item.Value.count > 1)
            {
                go = NGUITools.AddChild(containBagGrid, prefabItemE);
                go.transform.Find("E").Find("Label").GetComponent<UILabel>().text = item.Value.count.ToString();
                go.transform.Find("E").Find("Label").GetComponent<UILabel>().color = Color.white;
            }
            else
            {
                go = NGUITools.AddChild(containBagGrid, prefabItem);
            }
            go.transform.Find("Sprite").GetComponent<UISprite>().spriteName = item.Value.info.adress;
            go.name = item.Key.ToString();
            dictionaryUIBagItem.Add(j++, go);
        }
        containBagGrid.GetComponent<UIGrid>().enabled = true;
    }