Exemplo n.º 1
0
    public void setContent()
    {
        if(m_grassTex == null)
            m_grassTex = m_grassSkybox.GetComponent<GrassHandler>().GetDefaultTexs();

        if(m_grassThumbs == null){
            m_grassThumbs = m_grassSkybox.GetComponent<GrassHandler>().GetDefaultThumbs();
        }
        int i=0;
        if(m_grassThumbs.Length == m_grassTex.Length){
            int count = m_grassTex.Length;
            m_texArray = new Texture2D[count];
            Texture2D[] thumbsArray = new Texture2D[count];
            for(;i<count;i++){
                m_texArray[i] =(Texture2D) m_grassTex[i];
                thumbsArray[i] =(Texture2D) m_grassThumbs[i];
            }

            Texture2D grassTex;
            i=0;
            _matTexList = new GUIUpperList (1, 0, TextManager.GetText("Material"), "sousMenuOn", "sousMenuOff", this);
            _matTexList.setImgContent(m_texArray, thumbsArray);
            //_matTexList.display();
            visibility = true;
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        m_menuGroup = new Rect();
        m_menuGroup.Set(Screen.width-260,0,260,Screen.height);

        m_grassCurTex = (Texture2D) GameObject.Find("grassGround").GetComponent<Renderer>().material.GetTexture("_MainTex");
        _matTexMenu = new GUIItemV2 (0, 0, "Material", "sousMenuOn", "sousMenuOff", this);
        _matTexList = new GUIUpperList (1, 0, TextManager.GetText("material"), "sousMenuOn", "sousMenuOff", this);

        _matTexMenu.addSubItem (_matTexList);
        enabled = false;
    }
Exemplo n.º 3
0
    protected void SetThumbnails(OSLibStairs stairs)
    {
        _thumbnails = new Texture2D [stairs.GetStairList ().Count/* + 1*/];
        int textureCounter = 0;

        foreach (OSLibStair stair in stairs.GetStairList ())
        {
            Texture2D texture = stair.GetThumbnail ();
            texture.name = stair.GetDefaultText ();
            _thumbnails[textureCounter++] = texture;
        }

        //		Texture2D noStair = Resources.Load("thumbnails/noThumbs",typeof(Texture2D)) as Texture2D;
        //		noStair.name = "";
        //		_thumbnails[stairs.GetStairList ().Count] = noStair;
        _stairModelList = new GUIUpperList (1, 0, TextManager.GetText("stair"), "sousMenuOn", "sousMenuOff", this);
        _stairModelList.setImgContent (_thumbnails);
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        _stairMenu = new GUIItemV2 (0, 0, "Stair", "sousMenuOn", "sousMenuOff", this);
        _stairModelList = new GUIUpperList (1, 0, TextManager.GetText("stair"), "sousMenuOn", "sousMenuOff", this);

        _stairMenu.addSubItem (_stairModelList);
        enabled = false;
    }
Exemplo n.º 5
0
    public void CreateMenu(OSLib library)
    {
        _library = library;
        Montage.om.setLibrary(library); // < temporaire, mettre cette ligne ailleur
        //Menu ajout objets
        //GUIItemV2 originalsObj = new GUIItemV2(0,0,TextManager.GetText("GUIMenuLeft.Add"),"menuAddOn","menuAddOff",this);
        int x = 0;

        foreach(OSLibCategory catLvl1 in library.GetCategoryList ())
        {
            if (catLvl1.GetCategoryList ().Count > 0)
            {
                GUIItemV2 typToAdd;
                if(catLvl1.GetText (PlayerPrefs.GetString("language")) == "OneShot 3d")
                {
                    typToAdd = new GUIItemV2(0,x, catLvl1.GetText (PlayerPrefs.GetString("language")), "menuOSOn", "menuOSOff", this);
                }
                else
                {
                    typToAdd = new GUIItemV2(0,x, catLvl1.GetText (PlayerPrefs.GetString("language")), "menuAddOn", "menuAddOff", this);
                }

                _firstCategory[catLvl1.GetBrandId()]=x;
                x++;
                int y = 0;
                foreach(OSLibCategory catLvl2 in catLvl1.GetCategoryList ())
                {
                    _secondCategory[catLvl2.GetBrandId()]=y;

                    GUIUpperList fabToAdd = null;
                    string szparentCategory = catLvl2.GetText (PlayerPrefs.GetString("language") + "_parent");
                    if(szparentCategory != "")
                    {
                        foreach(GUIItemV2 guiItemV2 in listParentCategory)
                        {
                            if(szparentCategory == guiItemV2.m_text)
                            {
                                fabToAdd = new GUIUpperList(1,/*guiItemV2.getSubItemsCount()*/y, catLvl2.GetText (PlayerPrefs.GetString("language")), "sousMenuOn2", "sousMenuOff2", this);
                                guiItemV2.addSubItem(fabToAdd);
                                break;
                            }
                        }

                        if(fabToAdd == null)
                        {
                            GUIItemV2 parent = new GUIItemV2(1,listParentCategory.Count, szparentCategory,
                                                             "sousMenuOn", "sousMenuOff", this);

                            fabToAdd = new GUIUpperList(1,y, catLvl2.GetText (PlayerPrefs.GetString("language")), "sousMenuOn2", "sousMenuOff2", this);

                            parent.addSubItem(fabToAdd);
                            typToAdd.addSubItem(parent);

                            listParentCategory.Add(parent);
                        }
                    }
                    else
                    {
                        fabToAdd = new GUIUpperList(1,y, catLvl2.GetText (PlayerPrefs.GetString("language")), "sousMenuOn2", "sousMenuOff2", this);
                        typToAdd.addSubItem(fabToAdd);
                    }

                    y++;

                    int size = catLvl2.GetObjectList ().Count;
                    int numberPerPage = 24;
                    //Screen.currentResolution;

                    #if UNITY_IPHONE
                        numberPerPage = 9;
                    #else

                    if(Screen.currentResolution.width/Screen.currentResolution.height == 1.25f)
                        numberPerPage = 25;
                    else if(Screen.currentResolution.width/Screen.currentResolution.height == 1.6f)
                        numberPerPage = 24;
                    else
                        numberPerPage = 24;
                    #endif

                    if( size % numberPerPage != 0)
                    {
                        size = (catLvl2.GetObjectList ().Count/numberPerPage)*numberPerPage + numberPerPage;
                    }

                    Texture2D[] tmpTexs = new Texture2D[size];
                    string[] tmpTexts = new string[size];
                    bool[] tmpCustomizables = new bool[size];
                    bool[] tmpBrands = new bool[size];

                    int i = 0;
                    foreach(OSLibObject obj in catLvl2.GetObjectList ())
                    {
                        // load texture
                        Texture2D tmp = obj.GetThumbnail ();//Resources.Load (obj.GetThumbnailPath ());
                        if(tmp == null)
                            tmp =  Resources.Load ("thumbnails/noThumbs", typeof(Texture2D)) as Texture2D;
                        if(obj==null)
                            Debug.Log("Obj null");
                        if (obj.GetDefaultText ()==null)
                            Debug.Log("Obj null");
        //						tmp.name = obj.GetDefaultText ();
                        tmpTexts[i] = obj.GetText(PlayerPrefs.GetString("language"));
                        tmpTexs[i] = tmp;
                        tmpCustomizables[i] = obj.GetModules().GetStandardModuleList().Count > 0;
                        tmpBrands[i] = obj.IsBrandObject();
                        //print (tmpTexts[i]);

                        ++i;

                    }

                    fabToAdd.m_ctxPanelConfig = m_ctxPanelID_1;
                    fabToAdd.m_ctxPanelBrand = m_ctxPanelID_2;
                    fabToAdd.setImgContent(tmpTexs,tmpTexts, tmpCustomizables, tmpBrands);

                }

                Root.addSubItem(typToAdd);

            }

            if (catLvl1.GetObjectList ().Count > 0)
            {
                GUIUpperList fabToAdd = new GUIUpperList(0,x, catLvl1.GetDefaultText (), "sousMenuOn", "sousMenuOff", this);
                x++;

                Texture2D[] tmpTexs = new Texture2D[catLvl1.GetObjectList ().Count];
                int i = 0;
                foreach(OSLibObject obj in catLvl1.GetObjectList ())
                {
                    // load texture
                    Texture2D tmp = obj.GetThumbnail ();
                    if(tmp == null)
                        tmp =  Resources.Load ("thumbnails/noThumbs",typeof(Texture2D)) as Texture2D;

                    tmp.name = obj.GetText(PlayerPrefs.GetString("language"));// obj.GetDefaultText ();
                    tmpTexs[i] = (Texture2D)tmp;

                    ++i;
                }

                fabToAdd.setImgContent(tmpTexs);
                Root.addSubItem(fabToAdd);

            }

        }

        //Root.addSubItem(originalsObj);
        //print (x);
        if(usefullData._edition != usefullData.OSedition.Lite)
        {
            //Menu objets present dans la scene (sauf en édition lite)
            sceneObjs = new GUIItemV2(0,++x,TextManager.GetText("GUIMenuLeft.Select"),"menuSceneOn","menuSceneOff",this);
            Root.addSubItem(sceneObjs);
        }

        sceneObjs.SetEnableUI(GameObject.Find("MainNode").GetComponent<ObjBehavGlobal>().getNumberObjects() > 0);

        ResetMenu();
    }