Beispiel #1
0
    public void ButtonPressed_shop_GridItem(int itemIndex)
    {
        if(itemIndex >= shop_list_current.list_items.Count)
            return;

        string price = GetPrice(shop_list_current.list_items[itemIndex].item_attributes);

        transaction_pointA = shop_list_current;
        transaction_pointB = inventory.lists[0];
        transaction_itemIndex = itemIndex;
        transaction_moneytransfer = int.Parse(price);

        shop_confirmation_window.SetActive(true);

        if(GLOBAL.Player.progress["playercash"].i - transaction_moneytransfer < 0)
        {
            shop_confirmation_text.text = "insufficient funds";
            transaction_isGood = false;
        }
        else
        {
            shop_confirmation_text.text = "Purchase " + shop_list_current.list_items[itemIndex].item_name +
                " for $"+ transaction_moneytransfer;
            transaction_isGood = true;
        }
    }
Beispiel #2
0
    public void ButtonPressed_inventory_GridItem(int itemIndex)
    {
        InventoryHandler.Item_List       itemList = inventory.lists[0];
        InventoryHandler.Inventory_Item  item     = itemList.list_items[itemIndex];

        if(itemIndex >= itemList.list_items.Count)
            return;

        // selling
        if(shop_window.activeInHierarchy)
        {
            // check it out
            string check = CheckWhatYaSelling(item);
            if(check.Length > 1)
            {
                transaction_isGood = false;
                shop_confirmation_window.SetActive(true);
                shop_confirmation_text.text = check;
                return;
            }

            string price = GetPrice(item.item_attributes);
            transaction_isGood = true;
            transaction_pointA = inventory.lists[0];
            transaction_pointB = shop_list_current;
            transaction_itemIndex = itemIndex;
            transaction_moneytransfer = int.Parse(price);

            shop_confirmation_window.SetActive(true);

            shop_confirmation_text.text = "Sell " + item.item_name +
                    " for $"+ transaction_moneytransfer;
        }
        else
        {
            // looking into item
            bool isInspecting = true;

            if(item.item_attributes.Length > 1)
            {
                string[] attributes = item.item_attributes.Split(',');
                for(int a=0; a< attributes.Length; a++)
                {

                    // look through the attributes
                    if(attributes[a].Contains("TEXT"))
                    { // show text
                        string[] split = attributes[a].Split('=');
                        ShowText_Resource(split[1]); // file name in Resources/Inventory/TextFiles
                        isInspecting = false;
                        break;

                    }
                    else if(attributes[a].Contains("OUTFIT"))
                    {
                        int clothing_id = 0;
                        int clothing_score = 0;
                        int.TryParse(attributes[a].Split('=')[1], out clothing_id);
                        int.TryParse(attributes[a + 1].Split('=')[1], out clothing_score);

                        OutfitItemWasSelected(clothing_id, clothing_score);
                        isInspecting = false;
                        break;
                    }
                    else if(attributes[a].Contains("READ"))
                    {
                        string[] split = attributes[a].Split('=');
                        ShowText(MagsAndBooksData.dataDictionary[split[1]]);
                        ShowText(item.item_description);
                        isInspecting = false;
                        break;

                    }
                    else if(attributes[a].Contains("ICKIBIO"))
                    {
                        string[] split = attributes[a].Split('=');
                        Assets.Scripts.IckipediaDataScripts.IckipediaRootElement info = Assets.Scripts.IckipediaDataScripts.IckipediaData.IckipediaRootLevel[split[1]];
                        ShowText(info.Bio);
                        isInspecting = false;
                        break;

                    }
                    //else if(attributes[a].Contains("NEWS_NewCityExaminer"))
                    //{
                    //	string[] split = attributes[a].Split('=');
                    //	NewspaperData.NewspapersEnum Newspaper = NewspaperData.NewspapersEnum.NewCityExaminer;
        //
                    //	string data = "";
                    //	switch(int.Parse(split[1]))
                    //	{
                    //		case 0:
                    //		case 1:
                    //			data = NewspaperData.GetNewspaper(Newspaper).Week1;
                    //		break;
                    //		case 2:
                    //			data = NewspaperData.GetNewspaper(Newspaper).Week2;
                    //		break;
                    //		case 3:
                    //			data = NewspaperData.GetNewspaper(Newspaper).Week3;
                    //		break;
                    //	}
        //
                    //	ShowText(data);
                    //	isInspecting = false;
                    //	break;
        //
                    //}
                    //else if(attributes[a].Contains("NEWS_ElliotCountyCrier"))
                    //{
                    //	string[] split = attributes[a].Split('=');
                    //	NewspaperData.NewspapersEnum Newspaper = NewspaperData.NewspapersEnum.ElliotCountyCrier;
        //
                    //	string data = "";
                    //	switch(int.Parse(split[1]))
                    //	{
                    //	case 0:
                    //	case 1:
                    //		data = NewspaperData.GetNewspaper(Newspaper).Week1;
                    //		break;
                    //	case 2:
                    //		data = NewspaperData.GetNewspaper(Newspaper).Week2;
                    //		break;
                    //	case 3:
                    //		data = NewspaperData.GetNewspaper(Newspaper).Week3;
                    //		break;
                    //	}
        //
                    //	ShowText(data);
                    //	isInspecting = false;
                    //	break;
                    //}
                    else if(attributes[a].Contains("NEWS_"))
                    {
                        ShowText(item.item_description);
                        isInspecting = false;
                        break;
                    }
                }
            }
            if(isInspecting)
                ShowText(item.item_description);

        }
    }
Beispiel #3
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
         player_data_loaded = false;
         is_inventory_setup = false;
         shop_list_current = null;
     }
 }
Beispiel #4
0
    void OnDisable()
    {
        shop_window.SetActive(false);
        shop_confirmation_window.SetActive(false);
        shop_list_current = null;

        text_window.SetActive(false);

        SubText_Hide();
    }
Beispiel #5
0
    public static void OpenShopWindow(string shopName)
    {
        shop_list_current = instance.inventory.GetList(shopName);

        if(shop_list_current == null)
        {
            Debug.LogError("there is no list named "+ shopName);
            return;
        }

        if(!instance.canvas.activeInHierarchy)
            ToggleOpenClose(true);
            //GameObject.FindObjectOfType<UIManager>().InventoryAction(); replaced

        instance.shop_window.SetActive(true);

        Fill_The_Grid(shop_list_current, true);
    }