// 선택했던 아이템의 전 위치를 저장하기 위한 변수

    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < slotX * slotY; i++)
        {
            slots.Add(new Item());
            // 아이템 슬롯칸에 빈 오브젝트 추가하기
            inventory.Add(new Item());
            // 인벤토리에 추가
        }
        db = GameObject.FindGameObjectWithTag("Item Database").GetComponent <itemDatabase>();
        if (db == null)
        {
            Debug.Log("db가져오기실패");
        }
        // 디비 변수에 "Item Database" 태그를 가진 오브젝트를 연결합니다.
        // 그리고 그 중 가져오는 컴포넌트는 "itemDatabse"라는 속성입니다.

        AddItem(1001);
        // 아이템ID를 호출하도록 한다.
        AddItem(1011);
        AddItem(2001);
        // 테스트용 명령어
        AddItem(4001);
        // 물약 추가하기
    }
Esempio n. 2
0
    private bool preventExec;             //중복실행 제한

    void Start()
    {
        instance          = this;
        database          = FindObjectOfType <itemDatabase>();
        inventoryitemList = new List <Item>();
        inventoryTabList  = new List <Item>();
        slots             = tf.GetComponentsInChildren <Inventory_slot>(); //girdslot자식개체들이 모두slots에 들어감
    }
Esempio n. 3
0
    //private static int j;
    void Awake()
    {
        i = 0;
        //j = 0;

        collectableName = gameObject.name;
        inv = GameObject.Find ("Char_Cat").GetComponent<inventory>();
        database = GameObject.Find ("Items_ItemDatabase").GetComponent<itemDatabase>();
        //trophy = GameObject.Find ("trophy");
    }
Esempio n. 4
0
 void Start()
 {
     for (int i = 0; i < slotX * slotY; i++)
     {
         slots.Add(new Item());
         inventory.Add(new Item());
     }
     db     = GameObject.FindGameObjectWithTag("Item Database").GetComponent <itemDatabase>();
     player = GameObject.FindGameObjectWithTag("Player");
 }
Esempio n. 5
0
    public List <Item> slots = new List <Item>(); // 인벤토리 속성 변수



    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < slotX * slotY; i++)
        {
            slots.Add(new Item("", 0, "", 0, 0, 0, 0, Item.ItemType.Default));
            // 아이템 슬롯칸에 빈 오브젝트 추가하기
        }
        db = GameObject.FindGameObjectWithTag("Item Database").GetComponent <itemDatabase>();

        inventory.Add(db.items[0]);
    }
Esempio n. 6
0
    public void CallLoad()
    {
        BinaryFormatter bf = new BinaryFormatter(); //변환

        FileStream file = File.Open(Application.dataPath + "/SaveFile.dat", FileMode.Open);

        //    FileStream file = File.Open(Application.persistentDataPath + "/SaveFile.dat", FileMode.Open);
        if (file != null && file.Length > 0) //파일안에 무언가가 있다면
        {
            data = (Data)bf.Deserialize(file);

            database   = FindObjectOfType <itemDatabase>();
            TheInven   = FindObjectOfType <Inventory_k>();
            playerstat = FindObjectOfType <PlayerStat>();
            thetable   = FindObjectOfType <TableController>();
            thefloor   = FindObjectOfType <basefloorController>();
            thewall    = FindObjectOfType <floorController>();

            playerstat.Day      = data.day;
            playerstat.t_money  = data.totalMoney;
            playerstat.t_people = data.totalPpl;

            thefloor.Currentfloor = data.floor;
            thewall.Currentwall   = data.wall;
            thetable.CurrentTable = data.table;

            List <Item> itemList = Inventory_k.instance.inventoryitemList;

            for (int i = 0; i < data.ItemInventory.Count; i++) //저장된 인벤아이템 개수만큼 반복
            {
                for (int j = 0; j < database.items.Count; j++)
                {
                    if (data.ItemInventory[i] == database.items[j].itemID)
                    {
                        itemList.Add(database.items[j]);
                        Debug.Log("인벤토리 아이템 로드" + database.items[j].itemID);
                        break;
                    }
                }
            }

            for (int i = 0; i < data.ItemInventoryCnt.Count; i++)
            {
                itemList[i].itemCnt = data.ItemInventoryCnt[i];
            }
            Debug.Log("로드 완료");
        }
        else
        {
            Debug.Log("저장된 세이브 파일이 없습니다.");
        }

        file.Close();
    }
Esempio n. 7
0
    void Start()
    {
        for (int i = 0; i < (column * row); i++)
        {
            slots.Add(new item());
            inventory.Add(new item());
        }

        database = GameObject.FindGameObjectWithTag("ItemDatabase").GetComponent <itemDatabase>();
        AddItem(0);
    }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        // 먼저 리스트에 빈 오브젝트 추가
        for (int i = 0; i < transform.childCount; i++)
        {
            slots.Add(transform.GetChild(i).GetComponent <Slot>());
            transform.GetChild(i).GetComponent <Slot>().number = i;
        }

        // 디비 가져와서 (태그 설정과 스크립트 작성이 되어 있어야함)
        db = GameObject.FindGameObjectWithTag("Item Database").GetComponent <itemDatabase>();
    }
Esempio n. 9
0
 void Start()
 {
     for (int i = 0; i < (slotsX * slotsY); i++)
     {
         // used to populate the slots list and inventory list
         slots.Add(new item());
         inventoryList.Add(new item());
     }
     // the item database object will contain a tag called item database
     // we need the item database component on the game object which contains the list of
     // all game objects - this allows us to reference all needed items
     database = GameObject.FindGameObjectWithTag("Item Database").GetComponent <itemDatabase>();
 }
Esempio n. 10
0
    // 툴팁 추가를 위한 부울 변수와 스트링 변수

    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < slotX * slotY; i++)
        {
            slots.Add(new Item());
            // 아이템 슬롯칸에 빈 오브젝트 추가하기
            inventory.Add(new Item());
            // 인벤토리에 추가
        }
        db = GameObject.FindGameObjectWithTag("Item Database").GetComponent <itemDatabase>();
        // 디비 변수에 "Item Database" 태그를 가진 오브젝트를 연결합니다.
        // 그리고 그 중 가져오는 컴포넌트는 "itemDatabse"라는 속성입니다.

        AddItem(1001);
    }
Esempio n. 11
0
    void Awake()
    {
        itemDB = FindObjectOfType<itemDatabase>();
        if(item == null && itemID != "")
        {
            item = new itemBase(itemDB.getItemWithID(itemID));
            item.Quality = quality;
            item.Start();
        }

        if(item != null)
        {
            itemID = item.ID;
        }
    }
Esempio n. 12
0
    void Awake()
    {
        for (int i = 0; i < (slotsX * slotsY); i++)
        {
            slots.Add(new items());
            inventoryItem.Add (new items());
        }

        database = GameObject.FindGameObjectWithTag ("ItemDatabase").GetComponent<itemDatabase> ();

        //inventoryItem[0] = database.item[0];
        //inventoryItem[1] = database.item[1];

        //Debug.Log ("Number of Item: " + inventoryItem.Count);
        //inventoryItem.Add (database.item [0]);
        //Debug.Log ("Number of Item: " + inventoryItem.Count);
    }
Esempio n. 13
0
    public void CallSave()
    {
        database   = FindObjectOfType <itemDatabase>();
        TheInven   = FindObjectOfType <Inventory_k>();
        playerstat = FindObjectOfType <PlayerStat>();
        thetable   = FindObjectOfType <TableController>();
        thefloor   = FindObjectOfType <basefloorController>();
        thewall    = FindObjectOfType <floorController>();

        data.day        = playerstat.Day;
        data.totalMoney = playerstat.t_money;
        data.totalPpl   = playerstat.t_people;

        data.floor = thefloor.Currentfloor;
        data.wall  = thewall.Currentwall;
        data.table = thetable.CurrentTable;

        Debug.Log("기초 데이터 성공");

        data.ItemInventory.Clear(); //저장하고 다시 로드하면 저장한거의 2배가 저장되므로 초기화시킴
        data.ItemInventoryCnt.Clear();

        List <Item> itemList = Inventory_k.instance.inventoryitemList;// TheInven.inventoryitemList;

        for (int i = 0; i < itemList.Count; i++)
        {
            Debug.Log("인벤토리의 아이템 저장 완료 : " + itemList[i].itemID);
            data.ItemInventory.Add(itemList[i].itemID);
            data.ItemInventoryCnt.Add(itemList[i].itemCnt);
        }

        BinaryFormatter bf = new BinaryFormatter(); //변환

        FileStream file = File.Create(Application.dataPath + "/SaveFile.dat");

        //   FileStream file = File.Create(Application.persistentDataPath + "/SaveFile.dat");

        bf.Serialize(file, data);
        file.Close();

        Debug.Log(Application.dataPath + "의 위치에 저장완료");
    }
Esempio n. 14
0
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < slotX * slotY; i++)
        {
            slots.Add(new Item());
            // 아이템 슬롯칸에 빈 오브젝트 추가하기
            inventory.Add(new Item());
            // 인벤토리에 추가
        }
        db = GameObject.FindGameObjectWithTag("Item Database").GetComponent <itemDatabase>();
        // 디비 변수에 "Item Database" 태그를 가진 오브젝트를 연결합니다.
        // 그리고 그 중 가져오는 컴포넌트는 "itemDatabse"라는 속성입니다.

        //inventory[0] = db.items[0];
        //inventory[1] = db.items[1];
        for (int i = 0; /*db.items[i]!=null*/ i < slotX * slotY; i++)
        // 반복문을 이용하여 전체 인벤토리에 저장토록 합니다.
        {
            if (db.items[i] != null)
            {
                inventory[i] = db.items[i];
                // 디비의 아이템칸에 비어있지 않다면, 저장
            }
            else
            {
                // 디비의 아이템칸이 비어있다면 다른 행동을 하도록 유도합니다.
            }
        }
        // 인벤토리에 db에 저장되어있는 0번째 아이템을 가져오도록 합니다.

        /* for(int i=0; i<n; i++) {
         *      inventory.Add(db.items[i]);
         * }
         * 식으로 응용 가능하겠죠?
         */
    }
Esempio n. 15
0
    public void Start()
    {
        itemDB = GameObject.FindObjectOfType<itemDatabase>();

        //generating the slots is done in the object the storage is attached to, ie playerbase or containerbase
    }
Esempio n. 16
0
 void Start()
 {
     database = GameObject.FindGameObjectWithTag ("ItemDatabase").GetComponent<itemDatabase> ();
 }
Esempio n. 17
0
    // Use this for initialization
    void Start()
    {
        //Init player variables. Playername comes from network manager...
        experience = 0;
        money = 20;
        EquipRod(0);
        level = 1;
        strength = 5;
        isMoving = false;
        shoppingEnabled = false;
        fishingStatus = 0;

        //Get database for items...
        database = GameObject.FindGameObjectWithTag ("ItemDatabase").GetComponent<itemDatabase> ();

        //Load inventory with blanko...
        for(int i = 0; i < 6; i++)
        {
            inventory.Add(new Item());
        }
        AddItem (1);
    }
Esempio n. 18
0
    // Use this for initialization
    void Start()
    {
        for(int i = 0; i < (slotsX*SlotsY); i++)
        {
            slots.Add(new Item());
            inventory.Add(new Item());
        }

        //SET OFFSET FOR GUI
        inventoryOffsetX = Screen.width - (slotsX * 60);
        inventoryOffsetY = Screen.height - (SlotsY * 60);

        database = GameObject.FindGameObjectWithTag ("ItemDatabase").GetComponent<itemDatabase> ();
    }
Esempio n. 19
0
 void Awake()
 {
     itemDB = FindObjectOfType<itemDatabase>();
     if(typeID != null)
     {
         if(itemDB.getContainerWithID(typeID) != null)
         {
             containerBase cont = itemDB.getContainerWithID(typeID);
             ContainerName = cont.ContainerName;
             Storage = new storageBase(cont.Storage.Rows, cont.Storage.Cols, cont.Storage.Capacity, cont.Storage.SpoilRate);
         }
         else
         {
             print("id not found");
         }
         //containerBase(itemDB.getContainerWithID(typeID));
     }
     else
     {
         print("id not entered");
     }
 }