예제 #1
0
 private void ShowAllTiles()
 {
     foreach (var obj in CozyTiledFactory.GetTiles())
     {
         ContentControl control = null;
         if (obj.Value is CozyColorTile)
         {
             var ColorTile = obj.Value as CozyColorTile;
             var color     = ColorTile.ColorProperty;
             control = new SampleButton(0, 0)
             {
                 PreferredHeight = 32,
                 PreferredWidth  = 32,
                 Background      = new Starbound.UI.SBColor(color.R, color.G, color.B),
                 Foreground      = new Starbound.UI.SBColor(color.R, color.G, color.B),
             };
         }
         else if (obj.Value is CozySpriteTiled)
         {
             var SpriteTile = obj.Value as CozySpriteTiled;
             control = new TileButton(SpriteTile.Texture, SpriteTile.Rect);
         }
         if (control != null)
         {
             tilesPanel.AddChild(control, () => { CurrentTiledId = obj.Key; });
         }
     }
 }
예제 #2
0
    public void SwitchToLevels(int index)
    {
        string curLangSet = PlayerPrefs.GetString("setLang", "EN");
        string textLevel  = "NoName";

        if (curLangSet == "PL")
        {
            textLevel            = "Poziom ";
            tLevelsPackName.text = levelPackList[index].nameOfPack_Pol;
        }
        else
        {
            textLevel            = "Level ";
            tLevelsPackName.text = levelPackList[index].nameOfPack_Eng;
        }
        foreach (Transform child in contentPanelLevels)
        {
            GameObject.Destroy(child.gameObject);
        }
        //contentPanelLevels.DetachChildren();
        for (int i = 0; i < levelPackList[index].textAssetList.Count; i++)
        {
            GameObject newButton = buttonObjectPoolLevels.GetObject();
            newButton.transform.SetParent(contentPanelLevels);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(textLevel + (i + 1).ToString(), this, index, i);
        }
        goLevelsPacks.SetActive(false);
        goLevels.SetActive(true);
    }
예제 #3
0
 void ReleaseDesignerOutlets()
 {
     if (CheckAnswerButton != null)
     {
         CheckAnswerButton.Dispose();
         CheckAnswerButton = null;
     }
     if (ClearButton != null)
     {
         ClearButton.Dispose();
         ClearButton = null;
     }
     if (ResultTextView != null)
     {
         ResultTextView.Dispose();
         ResultTextView = null;
     }
     if (SampleButton != null)
     {
         SampleButton.Dispose();
         SampleButton = null;
     }
     if (TextMathiraiCount != null)
     {
         TextMathiraiCount.Dispose();
         TextMathiraiCount = null;
     }
     if (TextWord != null)
     {
         TextWord.Dispose();
         TextWord = null;
     }
 }
예제 #4
0
 //--------------------------------------------------------------------
 //-Player inventory Code ---------------------------------------------
 //--------------------------------------------------------------------
 private void PlayerAddButtons()
 {
     for (int i = 0; i < playerList.Count; i++)
     {
         Item       item      = playerList[i].itemShop;
         GameObject newButton = playerObjectPool.GetObject();
         newButton.transform.SetParent(playerContentPainel.transform);
         SampleButton sampleButton = newButton.GetComponent <SampleButton>();
         for (int j = 0; j < shopItemList.Count; j++)
         {
             if (item.itemName == shopItemList[j].itemShop.itemName)
             {
                 haveItemOnShop           = true;
                 shopPositonItemPriceTemp = j;
             }
         }
         if (haveItemOnShop)
         {
             sampleButton.Setup(item, this, playerContentPainel, i, shopItemList[shopPositonItemPriceTemp]);
         }
         else
         {
             sampleButton.Setup(item, this, playerContentPainel, i);
         }
         playerButtonList.Add(sampleButton);
         playerButtonList[i].tempShopPrices.amount = playerList[i].amount;
         playerButtonList[i].UpdateAmountPlayer();
     }
 }
예제 #5
0
    public void AddButtons()
    {
        foreach (Transform child in contentPanelLevelsPack)
        {
            GameObject.Destroy(child.gameObject);
        }
        string curLangSet = PlayerPrefs.GetString("setLang", "EN");

        for (int i = 0; i < levelPackList.Count; i++)
        {
            GameObject newButton = buttonObjectPoolLevelsPack.GetObject();
            newButton.transform.SetParent(contentPanelLevelsPack);
            string tempText = "NoName";
            if (curLangSet == "PL")
            {
                tempText = levelPackList[i].nameOfPack_Pol;
            }
            else
            {
                tempText = levelPackList[i].nameOfPack_Eng;
            }
            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(tempText, this, i, 0);
        }
    }
    protected void AddButton(string text, Factory stor)
    {
        GameObject newButton = buttonObjectPool.GetObject();

        newButton.transform.SetParent(contentPanel, true);
        SampleButton sampleButton = newButton.GetComponent <SampleButton>();

        sampleButton.Setup(text, this, stor);
    }
예제 #7
0
 void AddButtons()
 {
     for (int i = 0; i < itemList.Count; i++)
     {
         Item         item         = itemList[i];
         GameObject   newButton    = Instantiate(buttonPrefab, contentPanel);
         SampleButton sampleButton = newButton.GetComponent <SampleButton>();
         sampleButton.Setup(item, this);
     }
 }
예제 #8
0
    private void AddBuildButtons()
    {
        databaseReference = FirebaseDatabase.DefaultInstance.RootReference;
        Debug.Log("======= ADDING BUILD BUTTONS ========");
        FirebaseDatabase.DefaultInstance.GetReference("users").Child(username_static.userId).GetValueAsync().ContinueWith(task =>
        {
            if (task.IsFaulted)
            {
                //Handle Error
                Debug.Log("ERROR ==" + task.IsFaulted);
            }
            else if (task.IsCompleted)
            {
                DataSnapshot snapshot    = task.Result;
                List <string> mazeTitles = new List <string>();
                foreach (DataSnapshot data in snapshot.Children)
                {
                    mazeTitles.Add(data.Key);
                    //GameObject newButton = buttonObjectPool.GetObject();
                    //newButton.transform.SetParent(contentPanel);
                }

                foreach (string title in mazeTitles)
                {
                    Debug.Log(title);
                    GameObject newButton = buttonObjectPool.GetObject();
                    newButton.transform.SetParent(contentPanel);
                    SampleButton sampleButton = newButton.GetComponent <SampleButton>();
                    sampleButton.Setup(title, this, buildMode, playMode, username_static.userId);
                }
            }
        });


        //if (File.Exists(Application.persistentDataPath + "/userMazeData.data"))
        //{
        //    Debug.Log("== SAVE FILE EXISTS FOR SCROLL ==");
        //    // Load the information of userMazeData from file
        //    BinaryFormatter bf = new BinaryFormatter();
        //    FileStream file = File.Open(Application.persistentDataPath + "/userMazeData.data", FileMode.Open);
        //    Debug.Log(Application.persistentDataPath);
        //    UserMazeData userMazeData = (UserMazeData)bf.Deserialize(file);
        //    file.Close();
        //    MazeCollection mazeCollection = userMazeData.getMazeByUsername(username_static.username);
        //    Dictionary<String, MazeData> collection = mazeCollection.getCollection();
        //    foreach (KeyValuePair<String, MazeData> mazeData in collection)
        //    {
        //        Debug.Log("== ==");
        //        GameObject newButton = buttonObjectPool.GetObject();
        //        newButton.transform.SetParent(contentPanel);
        //        SampleButton sampleButton = newButton.GetComponent<SampleButton>();
        //        sampleButton.Setup(mazeData.Value, mazeData.Key, this);
        //    }
        //}
    }
    protected void AddButton(string text, FactoryType type)
    {
        GameObject newButton = buttonObjectPool.GetObject();

        newButton.transform.SetParent(contentPanel, true);
        SampleButton sampleButton = newButton.GetComponent <SampleButton>();

        //if (inventionType == null)
        //    sampleButton.Setup(text, this, null);
        //else
        sampleButton.Setup(text, this, type);
    }
    protected void AddButton(string text, PopUnit record)
    {
        GameObject newButton = buttonObjectPool.GetObject();

        newButton.transform.SetParent(contentPanel, true);
        //newButton.transform.SetParent(contentPanel);
        //newButton.transform.localScale = Vector3.one;

        SampleButton sampleButton = newButton.GetComponent <SampleButton>();

        sampleButton.Setup(text, this, record);
    }
예제 #11
0
    //--------------------------------------------------------------------
    //-Add to Inventory Code----------------------------------------------
    //--------------------------------------------------------------------
    private void AddToButtonsShopInventory()
    {
        for (int i = 0; i < shopItemList.Count; i++)
        {
            Item       item      = shopItemList[i].itemShop;
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel.transform);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(item, this, contentPanel, i, shopItemList[i]);
        }
    }
예제 #12
0
    private void AddButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Item       item      = itemList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(item, this);
        }
    }
예제 #13
0
 public void AddButtons()
 {
     for (int i = 0; i < Player.propertyList.Count; i++)
     {
         string nieruchomosci = Player.propertyList[i];
         newButton = buttonObjectPool.GetObject();
         newButton.GetComponentInChildren <Text>().text = Player.propertyList[i];
         newButton.transform.SetParent(contentPanel, false);
         SampleButton sampleButton = newButton.GetComponent <SampleButton>();
         sampleButton.Setup(nieruchomosci, scrollList);
     }
 }
예제 #14
0
    /// <summary>
    /// Adds the buttons.
    /// </summary>
    private void addButtons()
    {
        foreach (FileInfo f in info)
        {
            //Debug.Log(f.Name);
            GameObject newButton = GameObject.Instantiate(buttonPrefab);
            newButton.transform.SetParent(contentPanel);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.setup(f.Name.ToString());
        }
    }
    void AddButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Item       item      = itemList [i];
            GameObject newButton = (GameObject)Instantiate(buttonPrefab);
            newButton.transform.SetParent(contentPanel);
            newButton.transform.localScale = new Vector3(1, 1, 1);

            SampleButton sampleButton = newButton.GetComponent <SampleButton> ();
            sampleButton.Setup(item, this);
        }
    }
    private void AddButtons()
    {
        SceneTitle.text = "Players";
        for (int i = 0; i < playerlist.Count; i++)
        {
            Player     player    = playerlist[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(player, this);
        }
    }
 void PopulateList()
 {
     foreach (var item in itemList)
     {
         GameObject   newButton    = Instantiate(sampleButton) as GameObject;
         SampleButton buttonScript = newButton.GetComponent <SampleButton>();
         buttonScript.icon.sprite       = item.image;
         buttonScript.namelabel.text    = item.name;
         buttonScript.addresslabel.text = item.address;
         buttonScript.mapicon.sprite    = item.mapimage;
         buttonScript.button.onClick    = item.click;
         newButton.transform.SetParent(contentPanel);
     }
 }
    protected void AddButton(string text, PopUnit record, Func <string> dynamicTooltip)
    {
        GameObject newButton = buttonObjectPool.GetObject();

        newButton.transform.SetParent(contentPanel, true);
        //newButton.transform.SetParent(contentPanel);
        //newButton.transform.localScale = Vector3.one;

        SampleButton sampleButton = newButton.GetComponent <SampleButton>();

        sampleButton.Setup(text, this, record);
        newButton.GetComponentInChildren <ToolTipHandler>().dynamicString = dynamicTooltip;
        newButton.GetComponentInChildren <ToolTipHandler>().tip           = MainTooltip.thatObj;
    }
예제 #19
0
    private void AddButtons(Item item)
    {
        currentShopList.Add(item);
        GameObject newButton = (GameObject)GameObject.Instantiate(prefab);

        newButton.transform.SetParent(contentPanel, false);

        SampleButton sampleButton = newButton.GetComponent <SampleButton>();

        sampleButton.Setup(item, this);
        gameobjectShopList.Add(newButton);
        RefreshDisplay();
        gm.currentShopList = currentShopList;
    }
예제 #20
0
    void PopulateList()
    {
        foreach (var item in itemList)
        {
            GameObject   newButton = Instantiate(sampleButton) as GameObject;
            SampleButton button    = newButton.GetComponent <SampleButton> ();
            button.nameLabel.text = item.name;
            button.icon.sprite    = item.icon;
//			button.typeLabel.text = item.type;
//			button.rarityLabel.text = item.rarity;
//			button.championIcon.SetActive (item.isChampion);
            button.button.onClick = item.thingToDo;
            newButton.transform.SetParent(contentPanel);
        }
    }
예제 #21
0
    public void AddButtons(List <Games> gamesToAdd)
    {
        gameList = gamesToAdd;

        for (int i = 0; i < gameList.Count; i++)
        {
            Games      game      = gameList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(gamelistPanel);
            newButton.transform.localScale = new Vector3(1, 1, 1);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(game, this);
        }
    }
예제 #22
0
    private void AddButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            itemList[i].index       = i;
            itemList[i].price       = SaveManager.Instance.costs[i];
            itemList[i].numOwned    = SaveManager.Instance.upgrades[i];
            itemList[i].description = SaveManager.Instance.upgradesDes[i];
            Item       item      = itemList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(item, this);
        }
    }
예제 #23
0
    private void AddButtons()
    {
        //Debug.Log (itemList);
        for (int i = 0; i < itemList.Count; i++)
        {
            Debug.Log("once");
            Item       item      = itemList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            Debug.Log(newButton.tag);

            newButton.transform.SetParent(contentPanel, false);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(item, this);
        }
    }
예제 #24
0
 private void RemoveButtons(Item item)
 {
     currentShopList.Remove(item);
     for (int i = 0; i < gameobjectShopList.Count; i++)
     {
         GameObject   currentGameObject   = gameobjectShopList[i];
         SampleButton currentSampleButton = currentGameObject.GetComponent <SampleButton>();
         if (currentSampleButton.item == item)
         {
             print(item.itemName);
             Destroy(currentGameObject);
             gameobjectShopList.Remove(currentGameObject);
         }
     }
     RefreshDisplay();
 }
예제 #25
0
    void CreateButton(List <Item> items)
    {
        foreach (Item item in items)
        {
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel, false);

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(item, this);

            sampleButton.GetComponent <Button>().onClick.AddListener(() => {
                EMusic.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>("EMusic/Click");
                EMusic.GetComponent <AudioSource>().Play();
            });
        }
    }
예제 #26
0
    protected void AddButton(string text, Storage stor)
    {
        GameObject newButton = buttonObjectPool.GetObject();

        newButton.transform.SetParent(contentPanel, true);
        SampleButton sampleButton = newButton.GetComponent <SampleButton>();

        if (stor == null)
        {
            sampleButton.Setup(text, this, null);
        }
        else
        {
            sampleButton.Setup(text, this, stor.getProduct());
        }
    }
예제 #27
0
    private void AddButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Item       item      = itemList[i];
            GameObject newButton = buttonObjectPool.GetObject();

            newButton.transform.SetParent(contentPanel);

            newButton.transform.localScale    = Vector3.one;
            newButton.transform.localPosition = Vector3.zero;
            newButton.transform.localRotation = Quaternion.AngleAxis(0f, new Vector3(0f, 15f, 0f));

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            sampleButton.Setup(item, this);
        }
    }
    private void AddButtons()
    {
        List <GameObject> ll = new List <GameObject>();

        for (int i = 0; i < itemList.Count; i++)
        {
            Ticket item = itemList[i];
            //   GameObject newButton = buttonObjectPool.GetObject();

            GameObject obj = (GameObject)Instantiate(prefab);
            obj.transform.SetParent(contentPanel);
            ll.Add(obj);

            SampleButton sampleButton = obj.GetComponent <SampleButton>();
            sampleButton.Setup(item, this);
        }
    }
예제 #29
0
    protected void AddButtons()
    {
        for (int i = 0; i < ItemList.Count; i++)
        {
            Item       newItem   = ItemList[i];
            GameObject newButton = ButtonObjectPool.GetObject();
            newButton.transform.FindChild("ItemNameText").GetComponent <Text>().color  = newItem.TextColor;
            newButton.transform.FindChild("ItemPriceText").GetComponent <Text>().color = newItem.TextColor;
            newButton.transform.SetParent(ContentPanel);

            newButton.transform.localScale = localScaleVector3;

            SampleButton sampleButton = newButton.GetComponent <SampleButton>();
            SetButtonSize(sampleButton.button);
            sampleButton.Setup(newItem, this);
        }
    }
예제 #30
0
    public void PopulateList()
    {
        for (int i = 1; i <= listSize; i++)
        {
            GameObject   newButton = Instantiate(sampleButton) as GameObject;
            SampleButton button    = newButton.GetComponent <SampleButton> ();
            button.nameLabel.text = JSONScript._current.GetJsonObject(i - 1, "name");
            button.icon.sprite    = Resources.Load <Sprite>("Sprites/roleIdle" + i);
            button.number         = i - 1;
            //button.icon.sprite = item.icon;
            if (GameManager._myGameManager.stage >= i)
            {
                button.icon.enabled = true;
            }
            else
            {
                button.icon.enabled = false;
            }

            //button.button.onClick = item.thingToDo;
            newButton.transform.SetParent(contentPanel);

            newButton.transform.localScale    = new Vector3(1, 1, 1);
            newButton.transform.localPosition = new Vector3(transform.position.x, transform.position.y, 0);
            itemList.Add(newButton);
        }

        /*foreach (var item in itemList) {
         *      count ++;
         *      GameObject newButton = Instantiate (sampleButton) as GameObject;
         *      SampleButton button = newButton.GetComponent <SampleButton> ();
         *      button.nameLabel.text = "role"+count;
         *      button.icon.sprite = Resources.Load<Sprite>("Sprites/roleIdle"+count);
         *      //button.icon.sprite = item.icon;
         *      if(GameManager._myGameManager.stage >= count)
         *              button.icon.enabled = true;
         *      else
         *              button.icon.enabled = false;
         *
         *      //button.button.onClick = item.thingToDo;
         *      newButton.transform.SetParent (contentPanel);
         *      newButton.transform.localScale = new Vector3(1,1,1);
         *      newButton.transform.localPosition = new Vector3(transform.position.x,transform.position.y,0);
         * }*/
    }
예제 #31
0
    public void UpgradeSkill(SampleButton btn)
    {
        foreach (Skills sk in listAllSkills)
        {
            if (sk.priceToBuy <= currentXP)
            {
                if (btn.skillName.text == sk.skillName)
                {
                    if (sk.level < sk.maxLevel && sk.alreadyBuy)
                    {
                        sk.level += 1;

                        RefreshButtonUpgraded();
                        RefreshPlayerInterfaceInformations(sk);
                    }
                }
            }
        }
    }