Пример #1
0
    // Use this for initialization
    void Start()
    {
        m_cLoadCustomMapData = GameObject.Find("LoadData").GetComponent <C_LOADCUSTOMMAPDATA>();
        m_cBtnCtr            = GameObject.Find("Canvas").GetComponent <C_BTNCTR>();

        m_btnMy = gameObject.GetComponent <Button>();

        m_btnMy.onClick.AddListener(() => OnClick());
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        m_cLoadCustomMapData = GameObject.Find("LoadData").GetComponent <C_LOADCUSTOMMAPDATA>();

        float fSellWidthSize  = 0;
        float fSellHeightSize = 0;

        fSellWidthSize = gameObject.transform.parent.parent.parent.GetComponent <RectTransform>().rect.width *
                         (gameObject.transform.parent.parent.GetComponent <RectTransform>().anchorMax.x - gameObject.transform.parent.parent.GetComponent <RectTransform>().anchorMin.x);
        fSellHeightSize = gameObject.transform.parent.parent.parent.GetComponent <RectTransform>().rect.height *
                          (gameObject.transform.parent.parent.GetComponent <RectTransform>().anchorMax.y - gameObject.transform.parent.parent.GetComponent <RectTransform>().anchorMin.y) / 6.0f;
        m_lygContent  = gameObject.GetComponent <GridLayoutGroup>();
        PlayerManager = GameObject.Find("PlayerManager");


        m_lygContent.cellSize = new Vector2(fSellWidthSize - m_lygContent.padding.left * 2.0f, fSellHeightSize);
        nMapCount             = PlayerManager.GetComponent <ProductManager>().products.Count;

        //GameObject goButton = (GameObject)Resources.Load("ShopButton");
        GameObject goButton = (GameObject)Resources.Load("btnShop");

        GameObject goTmpButton;

        //for (int i = 0; i < nMapCount; i++)
        //{
        //    goTmpButton = Instantiate(goButton);
        //    goTmpButton.transform.SetParent(gameObject.transform);
        //    goTmpButton.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
        //    goTmpButton.AddComponent<C_SHOPMAINSELECT>().init(i);
        //}

        GameObject m_goStars;

        for (int i = 0; i < nMapCount; i++)
        {
            goTmpButton = Instantiate(goButton);
            goTmpButton.transform.SetParent(gameObject.transform);
            goTmpButton.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
            goTmpButton.transform.GetChild(1).gameObject.AddComponent <C_SHOPMAINSELECT>().init(i);

            m_goStars = goTmpButton.transform.GetChild(0).gameObject;
            m_cLoadCustomMapData.settingButton(i);
            int nDifficultyGame = (int)(m_cLoadCustomMapData.getDiffculty() + 3.0f - ((float)(m_cLoadCustomMapData.getStartResource()) / 1300.0f) - ((float)(m_cLoadCustomMapData.getStartCoinPrice()) / 800.0f));
            for (int j = 0; j < nDifficultyGame; j++)
            {
                m_goStars.transform.GetChild(j).gameObject.SetActive(true);
            }
        }


        gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(0.0f, fSellHeightSize * (float)nMapCount);
    }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     m_cLoadCustomMapData = GameObject.Find("LoadData").GetComponent <C_LOADCUSTOMMAPDATA>();
 }
Пример #4
0
 public void setData(C_LOADCUSTOMMAPDATA cLoadCustomData)
 {
     m_cLoadCustomMapData = cLoadCustomData;
 }