Exemple #1
0
    public void DeliveryScroll()
    {
        deliItemManager = GameObject.Find("DeliveryManager").GetComponent <DeliveryItemManager>();
        scrollDeli      = deliItemManager.GetDeliveryItems();

        Scroll_Initialize();
        foreach (KeyValuePair <DeliveryItem, int> pair in scrollDeli)
        {
            RectTransform item = GameObject.Instantiate(Prefab) as RectTransform;
            item.SetParent(transform, false);
            string itemName = deliItemManager.GetItemNameStr(pair.Key);

            Text[] nodePrefab = item.GetComponentsInChildren <Text>();
            nodePrefab[0].text = itemName;
        }
    }
Exemple #2
0
    // ロード機能
    public static void DataLoad()
    {
        player          = GameObject.Find("mkmk_Preußen");
        playerData      = player.GetComponent <PlayerData>();
        itemManager     = GameObject.Find("PlayerItemManager").GetComponent <PlayerItemManager>();
        deliItemManager = GameObject.Find("DeliveryManager").GetComponent <DeliveryItemManager>();

        // 位置情報
        float posX = PlayerPrefs.GetFloat("playerPos.x", 40);
        float posY = PlayerPrefs.GetFloat("playerPos.y", 0);
        float posZ = PlayerPrefs.GetFloat("playerPos.z", 40);
        //playerRotX = PlayerPrefs.GetFloat("playerRot.x");
        Vector3 loadPlayerPos = new Vector3(posX, posY, posZ);

        player.transform.position = loadPlayerPos;

        playerData.SetPlayerMoney(PlayerPrefs.GetInt("Money", 3000));
        playerData.SetDeliPoint(PlayerPrefs.GetInt("deliPoint", 0));

        // 通常アイテム情報(初期化含む)
        playerItemsList = itemManager.GetPlayerItems();
        List <Item> keyList1 = new List <Item>(playerItemsList.Keys);

        foreach (Item pair in keyList1)
        {
            string itemName = itemManager.GetItemNameStr(pair);
            playerItemsList[pair] = PlayerPrefs.GetInt(itemName, 0);
        }
        // 納品アイテム情報(初期化含む)
        deliItemsList = deliItemManager.GetDeliveryItems();
        List <DeliveryItem> keyList2 = new List <DeliveryItem>(deliItemsList.Keys);

        foreach (DeliveryItem pair2 in keyList2)
        {
            string itemName = deliItemManager.GetItemNameStr(pair2);
            deliItemsList[pair2] = PlayerPrefs.GetInt(itemName, 0);
        }

        player.GetComponent <PlayerMoveController>().SetPlayerData(player);
        itemManager.SetLoadItems(playerItemsList);
        deliItemManager.SetLoadDeliItems(deliItemsList);
    }