//----------------------------------------------------- public void CreateGui() { //UI Root = new GUIItemV2(-1,-1,"Root","","",this); //Title = new GUIItemV2(-1,-1,TextManager.GetText("GUIMenuInteraction.Options"),"title","title",this); Root.addSubItem(new GUIItemV2(0,2,TextManager.GetText("GUIMenuInteraction.Configure"),"configOn","configOff",this));//2 indexConf = 0; Root.addSubItem(new GUIItemV2(0,0,TextManager.GetText("GUIMenuInteraction.NewObject"),"newOn","newOff",this));//0 Root.addSubItem(new GUIItemV2(0,3,TextManager.GetText("GUIMenuInteraction.Replace"),"swapOn","swapOff",this));//3 if(usefullData._edition != usefullData.OSedition.Lite) Root.addSubItem(new GUIItemV2(0,4,TextManager.GetText("GUIMenuInteraction.Copy"),"copyOn","copyOff",this));//4 Root.addSubItem(new GUIItemV2(0,5,TextManager.GetText("GUIMenuInteraction.Refocus"),"reinitOn","reinitOff",this));//5 if(usefullData._edition != usefullData.OSedition.Lite) { Root.addSubItem(new GUIItemV2(0,1,TextManager.GetText("GUIMenuInteraction.Lock"),"lockOn","lockOff",this));//1 indexLock = 5; } Root.addSubItem(new GUIItemV2(0,6,TextManager.GetText("GUIMenuInteraction.Delete"),"suppressOn","suppressOff",this));//6 }
//----------------------------------------------------- public void ResetMenu() { //selM = -1; selTyp = -1; selFab = -1; selObj = -1; if(Root.getSelectedItem()!= null)//menu { if(Root.getSelectedItem().getSelectedItem()!=null)//sous menu { if(Root.getSelectedItem().getSelectedItem().getSelectedItem() != null)//tool { if(Root.getSelectedItem().getSelectedItem().getSelectedItem().getSelectedItem() != null)//tool { Root.getSelectedItem().getSelectedItem().getSelectedItem().resetSelected(); } Root.getSelectedItem().getSelectedItem().resetSelected(); } Root.getSelectedItem().resetSelected(); } Root.resetSelected(); } // -- Menu objets toujours ouvert en édition lite -- if(usefullData._edition == usefullData.OSedition.Lite) { selFab = 0; Root.setSelected(0); } activeItem = null; }
public void updateGUI(GUIItemV2 itm,int val,bool reset) { }
void OnEnable() { _root = new GUIItemV2(-1, -1, "Root", "", "", this); _root.addSubItem (_matTexMenu); setContent(); }
void OnDisable() { m_off7 = Screen.width; showMenu = false; if(Camera.main) Camera.main.GetComponent<ObjInteraction>().configuringObj(obj2config);//<- on remet obj2config dans selectedObj obj2config = null; activeItem = null; Resources.UnloadUnusedAssets(); }
public void setGUIItem(GUIItemV2 _guiItem) { guiItem = _guiItem; }
private GUIItemV2 GetRoot() { if( Root==null) { Root = new GUIItemV2(-1,-1,"Root","","",this); } return Root; }
public void CreateGui() { //Debug.Log("Creation de la GUI START"); //NEW INTERFACE------------------------- //Title = new GUIItemV2(-1,-1,TextManager.GetText("GUIStart.Title"),"title","title",this); //Root = new GUIItemV2 (-1,-1, "Root", "", "", this); GUIItemV2 pjt = new GUIItemV2(0,1,TextManager.GetText("GUIStart.NewProject"),"menuProjOn","menuProjOff",this); #if UNITY_IPHONE && !UNITY_EDITOR if(m_authPhotoPerso) { pjt.addSubItem (new GUIItemV2 (1,1, TextManager.GetText("GUIStart.TakePicture"), "menuOn", "menuOff", this)); if(usefullData._edition == usefullData.OSedition.Full) { pjt.addSubItem (new GUIItemV2 (1,2,TextManager.GetText("GUIStart.LoadPicture"), "menuOn", "menuOff", this)); } } #elif UNITY_ANDROID && !UNITY_EDITOR if(m_authPhotoPerso) { pjt.addSubItem (new GUIItemV2 (1,3, TextManager.GetText("GUIStart.TakePicture"), "menuOn", "menuOff", this)); if(usefullData._edition == usefullData.OSedition.Full) { pjt.addSubItem (new GUIItemV2 (1,4,TextManager.GetText("GUIStart.LoadPicture"), "menuOn", "menuOff", this)); } } #else if(m_authPhotoPerso && usefullData._edition == usefullData.OSedition.Full) { pjt.addSubItem (new GUIItemV2 (1,5, TextManager.GetText("GUIStart.LoadPicture"), "menuOn", "menuOff", this)); } #endif _itemPhotoExample = new GUIItemV2 (1,6, TextManager.GetText("GUIStart.ExamplePicture"), "menuOn", "menuOff", this); pjt.addSubItem (_itemPhotoExample); GetRoot().addSubItem(pjt); if(m_authClientsFile) { GetRoot().addSubItem (new GUIItemV2 (0,0, TextManager.GetText("GUIStart.Dossiers"), "menuFilesOn", "menuFilesOff", this)); } /* #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_IPHONE _itemUpdate = new GUIItemV2 (0,6, TextManager.GetText("GUIStart.UpdateDispo"), "alertOn", "alertOff", this); GetRoot().addSubItem (_itemUpdate); #endif*/ //menu Parametres GUIItemV2 param = new GUIItemV2(0,10,TextManager.GetText("GUIMenuRight.Software"),"menuSoftOn","menuSoftOff",this); //menu touch windows /* #if UNITY_STANDALONE_WIN if(PC.In.TouchSupported()){ int touchpref=PlayerPrefs.GetInt("win8TouchEnable",1); _btnSwitchTouch = new GUICheckbox(1,7, TextManager.GetText("GUIStart.TouchInterface"),"outilOn","outilOff",this); if(touchpref==1){ ((GUICheckbox)_btnSwitchTouch).SetValue (true); } else{ ((GUICheckbox)_btnSwitchTouch).SetValue (false); PC.In=MouseInput.GetInstance(); } param.addSubItem(_btnSwitchTouch); } #endif */ //SOUS MENU langues param.addSubItem( new GUIItemV2(1,5,TextManager.GetText("GUIMenuRight.Historic"),"outilOn","outilOff",this)); GUIItemV2 rgSubMenuLanguage = new GUIItemV2(1,1,TextManager.GetText("GUIMenuRight.Language"),"outilOn","outilOff",this);//2 param.addSubItem(rgSubMenuLanguage); param.addSubItem( new GUIItemV2(1,2,TextManager.GetText("GUIMenuRight.apropos"),"outilOn","outilOff",this)); /*_btnSwitchAidePopup = new GUICheckbox(1,3, TextManager.GetText("GUIStart.HelpPopup"),"outilOn","outilOff",this); ((GUICheckbox)_btnSwitchAidePopup).SetValue (true); if(PlayerPrefs.HasKey("HelpPopup")) if (PlayerPrefs.GetInt("HelpPopup")==0) ((GUICheckbox)_btnSwitchAidePopup).SetValue (false); param.addSubItem(_btnSwitchAidePopup);*/ #if UNITY_IPHONE param.addSubItem( new GUIItemV2(1,4,TextManager.GetText("GUIMenuRight.ContactUs"),"outilOn","outilOff",this)); #endif param.addSubItem( new GUIItemV2(1,0,TextManager.GetText("GUIMenuRight.Deactivate"),"outilOn","outilOff",this)); GetRoot().addSubItem (param); #if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_IPHONE _itemUpdate = new GUIItemV2 (0,11, TextManager.GetText("GUIStart.UpdateDispo"), "alertOff", "alertOff", this); GetRoot().addSubItem (_itemUpdate); #endif _itemQuit = new GUIItemV2(0, 9, TextManager.GetText("GUIStart.Exit"), "menuQuitOn", "menuQuitOff", this); GetRoot().addSubItem(_itemQuit); }
// FCN. AUX. PUBLIC------------------------------------ public void updateGUI(GUIItemV2 itm,int val,bool reset) { if(PC.ctxHlp.PanelBlockingInputs()) { resetMenu(); return; } activeItm = itm; switch (itm.getDepth()) { case 0: selM = val; break; } ui2fcn(); }
public void updateGUI(GUIItemV2 itm,int val,bool reset) { switch (itm.getDepth ()) { case 0: if (val == 2) // move plan mode { _mode = PoolDesignerMode.PlanTransformation; bgImgMode = false; } else { if (val == -1 && lastUIValue != 10 && lastUIValue != 0) { selectEditMode = true; } _mode = PoolDesignerMode.PolygonEdition; } if (val == 4) // remove point { int selectedPointIndex = _polyDrawer.GetSelectedPointIndex (); if (selectedPointIndex >= 0) { _polyDrawer.ResetSelection (); _polygon.RemovePoint (selectedPointIndex); if (_polygon.GetPoints ().Count < 3) { _polygon.SetClosed (false); } } RightRoot.resetSelected (); } if (val == 5) // affichage du menu image { bgImgMode = true; showBgImgMenu = true; showRightMenu = false; } else if (val < 7 && (val != -1 || lastUIValue != 10)) { bgImgMode = false; showBgImgMenu = false; bgImgRoot.resetSelected (); } if (val == 7) // chargement de l'image { loadImage (); } if (itm == _showHideBackgroundImage) // afficher/masquer l'image { GUICheckbox ckbx = itm as GUICheckbox; _function.SetBackgroundImageVisible (ckbx.GetValue ()); } if (val == 9) // regler l'echelle de l'image { showLeftMenu = false; if (bgImgMode) { showBgImgMenu = false; } showRightMenu = false; canDisp = false; _mode = PoolDesignerMode.BackgroundScale; } if (val == 10) // translation de l'image { _mode = PoolDesignerMode.BackgroundTranslation; } if (val == 11) // suppression de l'image { Texture2D bgImg = _function.GetBackgroundImage (); if (bgImg != null) { _function.SetBackgroundImage (bgImg); Destroy (bgImg); } } if (val > 6 && val != 10) { bgImgRoot.resetSelected (); } break; case 1: if (itm == _alignedSnapping) // snap { GUICheckbox ckbx = itm as GUICheckbox; _snapper.SetAlignedPointSnapActive (ckbx.GetValue ()); } // if (itm == _angleSnapping) // { // GUICheckbox ckbx = itm as GUICheckbox; // } /*if (val == 2) { _planTransformation.ZoomToPolygon (_polygon); ((GUIItemV2)LeftRoot.getSubItems ()[2]).resetSelected (); }*/ if (itm == _squareCotation) // cotation global { GUICheckbox ckbx = itm as GUICheckbox; _polyDrawer.SetMaxDimensionVisible (ckbx.GetValue ()); val++; } if (itm == _edgeCotation) // cotation par segment { GUICheckbox ckbx = itm as GUICheckbox; _polyDrawer.SetCotationVisible (ckbx.GetValue ()); val++; } bgImgMode = false; showBgImgMenu = false; break; } lastUIValue = val; if(!_isSliding) ui2fcn (); }
public void CreateGui() { // menu niveau GUIItemV2 edition = new GUIItemV2 (0, 0, TextManager.GetText("PoolDesigner.Edit"), "leftOutilOn", "leftOutilOff", this, true); GUIItemV2 snap = new GUIItemV2 (0, 1, TextManager.GetText("PoolDesigner.Snap"), "leftOutilOn", "leftOutilOff", this, true); GUIItemV2 plan = new GUIItemV2 (0, 2, TextManager.GetText("PoolDesigner.Plan"), "leftOutilOn", "leftOutilOff", this, true); GUIItemV2 img = new GUIItemV2 (0, 5, TextManager.GetText("PoolDesigner.Image"), "leftOutilOn", "leftOutilOff", this, true); GUIItemV2 cotation = new GUIItemV2 (0, 6, TextManager.GetText("PoolDesigner.Cotation"), "leftOutilOn", "leftOutilOff", this, true); // snap _alignedSnapping = new GUICheckbox (1, 0, TextManager.GetText("PoolDesigner.AlignedSnap"), "leftOutilOn", "leftOutilOff", this); _alignedSnapping.SetValue (true); _angleSnapping = new GUICheckbox (1, 1, TextManager.GetText("PoolDesigner.AngleSnap"), "leftOutilOn", "leftOutilOff", this); snap.addSubItem (_alignedSnapping); //snap.addSubItem (_angleSnapping); // cotation _squareCotation = new GUICheckbox (1, 2, TextManager.GetText("PoolDesigner.SquareCotation"), "leftOutilOn", "leftOutilOff", this); _edgeCotation = new GUICheckbox (1, 3, TextManager.GetText("PoolDesigner.EdgeCotation"), "leftOutilOn", "leftOutilOff", this); _edgeCotation.SetValue (true); cotation.addSubItem (_squareCotation); cotation.addSubItem (_edgeCotation); // GUIItemV2 zoomToPoly = new GUIItemV2 (1, 2, TextManager.GetText("PoolDesigner.ZoomToPoly"), "leftOutilOn", "leftOutilOff", this); //plan.addSubItem (zoomToPoly); GUIItemMultiBtn validCancelReset = new GUIItemMultiBtn (0, "multi_bg", "", "", this, 20, true); GUIAutoItem clear = new GUIAutoItem (1, "", "clear", "clear", this); clear.doEvent += Clear; validCancelReset.addSubItem (clear); GUIAutoItem reset = new GUIAutoItem (1, "", "reset", "reset", this); reset.doEvent += Reset; validCancelReset.addSubItem (reset); GUIAutoItem valid = new GUIAutoItem (1, "", "valid", "valid", this); valid.doEvent += Validate; validCancelReset.addSubItem (valid); _curveSlider = new GUIHSlider (0, 3, "rightOutilOn", "rightOutilOff", this); GUIItemV2 delete = new GUIItemV2 (0, 4, TextManager.GetText("PoolDesigner.RemovePoint"), "rightOutilOn", "rightOutilOff", this); // menu image niveaux 0 GUIItemV2 load = new GUIItemV2 (0, 7, TextManager.GetText("PoolDesigner.Image.Load"), "rightOutilOn", "rightOutilOff", this); _showHideBackgroundImage = new GUICheckbox (0, 8, TextManager.GetText("PoolDesigner.Image.ShowHide"), "rightOutilOn", "rightOutilOff", this); _showHideBackgroundImage.SetValue (true); GUIItemV2 scale = new GUIItemV2 (0, 9, TextManager.GetText("PoolDesigner.Image.Scale"), "rightOutilOn", "rightOutilOff", this); GUIItemV2 position = new GUIItemV2 (0, 10, TextManager.GetText("PoolDesigner.Image.Move"), "rightOutilOn", "rightOutilOff", this); GUIItemV2 removeImg = new GUIItemV2 (0, 11, TextManager.GetText("PoolDesigner.Image.Remove"), "rightOutilOn", "rightOutilOff", this); LeftRoot = new GUIItemV2 (-1, -1, "Root", "", "", this); LeftRoot.addSubItem (edition); LeftRoot.addSubItem (snap); LeftRoot.addSubItem (plan); LeftRoot.addSubItem (img); LeftRoot.addSubItem (cotation); LeftRoot.addSubItem (validCancelReset); RightRoot = new GUIItemV2 (-1, -1, "Root", "", "", this); RightRoot.addSubItem (_curveSlider); RightRoot.addSubItem (delete); bgImgRoot = new GUIItemV2 (-1, -1, "Root", "", "", this); bgImgRoot.addSubItem (load); bgImgRoot.addSubItem (_showHideBackgroundImage); bgImgRoot.addSubItem (scale); bgImgRoot.addSubItem (position); bgImgRoot.addSubItem (removeImg); LeftTitle = new GUIItemV2 (-1, -1, TextManager.GetText("PoolDesigner.LeftTitle"), "leftTitle", "leftTitle", this); RightTitle = new GUIItemV2 (-1, -1, TextManager.GetText("PoolDesigner.RightTitle"), "rightTitle", "rightTitle", this); bgImgTitle = new GUIItemV2 (-1, -1, TextManager.GetText("PoolDesigner.Image"), "rightTitle", "rightTitle", this); leftMenuGroup = new Rect(leftOff7, 0, 300, UnityEngine.Screen.height); rightMenuGroup = new Rect(rightOff7, 0, 300, UnityEngine.Screen.height); bgImgMenuGroup = new Rect(bgImgOff7, 0, 300, UnityEngine.Screen.height); leftRect = new Rect(leftOff7, UnityEngine.Screen.height / 2 - 200, 260, 420); rightRect = new Rect(rightOff7, UnityEngine.Screen.height / 2 - 100, 260, 200); bgImgRect = new Rect(bgImgOff7, UnityEngine.Screen.height / 2 - 150, 280, 300); LeftRoot.setSelected (0); canDisp = true; }
//----------------------------------------------------- public void updateSceneObj() { if(usefullData._edition == usefullData.OSedition.Lite) // Do nothing in lite edition (no "scene objects" menu) return; ArrayList tmpList = new ArrayList(); string s; GUIItemV2 uniques = new GUIItemV2(1,2, TextManager.GetText("GUIMenuLeft.Unique"), "sousMenuOn", "sousMenuOff", this); //onglet regroupant la liste des objets if(mainNode.transform.GetChildCount() > 0) { tmpList.Add(new GUIItemV2(1,0, TextManager.GetText("GUIMenuLeft.All"), "outilOn", "outilOff", this)); // Pour deplacement de toute la scene tmpList.Add(new GUIItemV2(1,1, TextManager.GetText("GUIMenuLeft.Several"), "outilOn", "outilOff", this)); // Pour activer la selection par group tmpList.Add(uniques); } int i=0; foreach(Transform t in mainNode.transform) { if(t.name != "_avatar") { // s = t.name.Replace("(Clone)",""); if(t.GetComponent<ObjData>().GetObjectModel() != null) { s = t.GetComponent<ObjData>().GetObjectModel().getCategory().GetText(PlayerPrefs.GetString("language")); s = s +" - "+ t.GetComponent<ObjData>().GetObjectModel().GetText(PlayerPrefs.GetString("language")); /*tmpList*/uniques.addSubItem(new GUIItemV2(/*1*/2,i,s,"outilOn","outilOff",this)); i++; } else { print ("error !!!"); } } } sceneObjs.setItems(tmpList); }
//FCN. AUX. PUBLIC-------------------- public void updateGUI(GUIItemV2 itm,int val,bool reset) { if(PC.ctxHlp.PanelBlockingInputs()) return; if(reset) activeItem = itm; if(val == -1) activeItem = null; switch (itm.getDepth()) { case 0: selFab = val; if(reset) { selTyp = -1; selObj = -1; if(itm.getSelectedItem()!=null && itm.getSelectedItem().getSelectedItem()!=null) itm.getSelectedItem().resetSelected(); if(itm.getSelectedItem()!=null) itm.resetSelected(); } break; case 1: foreach(GUIItemV2 guiItemV2 in listParentCategory) { if(guiItemV2.m_text == itm.m_text) { break; //Skip parent } } selTyp = val; if(reset) { selObj = -1; if(itm.getSelectedItem()!=null) itm.resetSelected(); } break; case 2: selObj = val; break; } // if(Input.touchCount>0)//anti slide and select a reefaire // if(Input.touches[0].phase == TouchPhase.Moved) // return; if(!PC.In.Drag1()) ui2Fcns(); /*ulActive = false; if(activeItem != null) { if(activeItem.GetType() == typeof(GUIUpperList)) { ulActive = true; if(isUpperList==false) scrollpos.y+=ulOff7; isUpperList = true; // ulOff7 = 0.0f; } else { isUpperList = false; // ulOff7 = 150.0f; } }*/ //int[] indexs = new int[4]; //indexs[0] = selM; //indexs[1] = selFab; //indexs[2] = selTyp; //indexs[3] = selObj; //UsefullEvents.FireUpdateUIState(GetType().ToString(),indexs); //Debug.Log("m>"+selM+"<fab>"+selFab+"<typ>"+selTyp+"<obj>"+selObj); }
public void setMenuState() { selFab = bkupSelFab; selTyp = bkupSelTyp; selObj = bkupSelObj; if(Root.getSubItemsCount()>0 && selFab != -1) { Root.setSelected(selFab); if(Root.getSelectedItem() != null && Root.getSelectedItem().getSubItemsCount()>0 && selTyp != -1) { Root.getSelectedItem().setSelected(selTyp); if(Root.getSelectedItem().getSelectedItem() != null) { if(Root.getSelectedItem().getSelectedItem().GetType() == typeof(GUIUpperList)) { activeItem = Root.getSelectedItem().getSelectedItem(); } else { Root.getSelectedItem().getSelectedItem().setSelected(selObj); if(Root.getSelectedItem().getSelectedItem().getSelectedItem() != null && Root.getSelectedItem().getSelectedItem().getSelectedItem().GetType() == typeof(GUIUpperList)) { activeItem = Root.getSelectedItem().getSelectedItem().getSelectedItem(); } } } } } }
public void returnToLvlOne() { /*if(selM == 0)//Retour au niveau 1 {*/ if(Root.getSelectedItem()!= null)//menu { if(Root.getSelectedItem().getSelectedItem()!=null)//sous menu { if(Root.getSelectedItem().getSelectedItem().getSelectedItem()!=null) { Root.getSelectedItem().getSelectedItem().getSelectedItem().resetSelected(); activeItem = null; } Root.getSelectedItem().getSelectedItem().resetSelected(); } } //} if(activeItem != null && activeItem.GetType() == typeof(GUIUpperList)) { activeItem = null; } }
//Affichage des sous items public virtual void showSubItms() { //bisSecondButton = false; foreach(GUIItemV2 itm in subItems) { if(itm != null) { if(itm.IsEnableUI()) { if(itm == selectedItm) { if((itm.getSubItemsCount()>0)||(itm.isToogleActivated())) { if(itm.getUI(true)) { origine.updateGUI(selectedItm,-1,true); selectedItm = null; } itm.showSubItms(); } else { itm.getUI(true); } } else { if(!itm.DontHideWhenSelected()) { /*if(selectedItm != null && itm.m_depth == 0) GUI.color = new Color(1,1,1,0.75f);*/ } else { //GUI.color = new Color(1,1,1,1); } if(itm.getUI(false)) { selectedItm = itm; origine.updateGUI(selectedItm,/*getSubItemIndex(selectedItm)*/selectedItm.m_actionId,true); } //GUI.color = new Color(1,1,1,1); } } } } }
//Ajout de 1 SubItem public virtual void addSubItem(GUIItemV2 itm) { subItems.Add(itm); m_subItemsCount ++; }
//ajout d'un item public override void addSubItem(GUIItemV2 itm) { subItems.Add(itm); m_subItemsCount ++; }
public void updateGUI(GUIItemV2 itm, int val, bool reset) { switch (itm.getDepth()) { case 0: m_selM = val; if(reset) { m_selSM = -1; m_selT = -1; if(itm.getSelectedItem()!=null && itm.getSelectedItem().getSelectedItem()!=null) itm.getSelectedItem().resetSelected(); if(itm.getSelectedItem()!=null) itm.resetSelected(); } break; case 1: m_selSM = val; if(reset) { m_selT = -1; if(itm.getSelectedItem()!=null) itm.resetSelected(); } break; case 2: m_selT = val; break; } int[] indexs = new int[3]; indexs[0] = m_selM; indexs[1] = m_selSM; indexs[2] = m_selT; UsefullEvents.FireUpdateUIState(GetType().ToString(),indexs); // ui2fcn (); }
void OnEnable() { _root = new GUIItemV2(-1, -1, "Root", "", "", this); _root.addSubItem (_stairMenu); }
public void setGUIItem(GUIItemV2 _guiItem) { }
// 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; }
//FCN. AUX. PUBLIC-------------------- public void updateGUI(GUIItemV2 itm,int val,bool reset) { /*if(activeItem == itm && val == -1) activeItem = null; else*/ if(reset) activeItem = itm; if(val == -1) activeItem = null; switch (itm.getDepth()) { case 0: selConfig = val; if(reset) { selObj = -1; selT = -1; if(itm.getSelectedItem()!=null && itm.getSelectedItem().getSelectedItem()!=null) itm.getSelectedItem().resetSelected(); if(itm.getSelectedItem()!=null) itm.resetSelected(); } break; case 1: selObj = val; if(reset) { selT = -1; if(itm.getSelectedItem()!=null) itm.resetSelected(); } break; case 2: selT = val; break; } ui2fcn(); }
public void updateGUI(GUIItemV2 itm,int val,bool reset) { switch (itm.getDepth()) { case 0: if(reset) { _stairIndex = -1; if(itm.getSelectedItem()!=null && itm.getSelectedItem().getSelectedItem()!=null) itm.getSelectedItem().resetSelected(); if(itm.getSelectedItem()!=null) itm.resetSelected(); } break; case 1: if(reset) { _stairIndex = -1; if(itm.getSelectedItem()!=null) itm.resetSelected(); } break; case 2: _stairIndex = val; // if (_stairIndex >= _thumbnails.Length - 1) // { // _stairIndex = -1; // } _controller.SetStairIndex (_stairIndex); break; } ui2fcn (); }
void OnEnable() { GUI.skin = skin; m_off7 = Screen.width; Root = new GUIItemV2(-1,-1,"Root","","",this); GUIItemV2 mapsConfig = new GUIItemV2(0,0,TextManager.GetText("GUIMenuConfiguration.Materials"),"MaterialOn","MaterialOff",this); specFunctions = new GUIItemV2(0,1,TextManager.GetText("GUIMenuConfiguration.SpecialFunction"),"FunctionOn","FunctionOff",this); //Textures et couleurs obj2config = Camera.main.GetComponent<ObjInteraction>().configuringObj(null);// <- récupération de l'objet a configurer ObjData objData = obj2config.GetComponent <ObjData> (); OSLibObject obj = objData.GetObjectModel (); // get from obj2congfig OSLibModules modules = obj.GetModules (); int x = 0; //Debug.Log("Nb De Mobules>"+modules.GetStandardModuleList ().Count); foreach (OSLibModule module in modules.GetStandardModuleList ()) { int thumbCount = module.GetTextureList ().Count + module.GetColorList ().Count; // string nameThumb = ""; if (thumbCount > 0/* || true*/) { Texture2D [] thumbnails = new Texture2D [thumbCount]; string [] nameThumbs = new string [thumbCount]; int textIndex = 0; foreach (OSLibColor col in module.GetColorList ()) //Ajout des vignettes des couleurs { Texture2D thumbnail = col.GetThumbnail (); nameThumbs[textIndex] = col.GetText(PlayerPrefs.GetString("language")); if (thumbnail != null) thumbnails[textIndex++] = thumbnail; else { Color colorThumb = col.GetColor(); thumbnail = new Texture2D(128,128); for (int cy=0; cy<128;cy++) for(int cx=0; cx<128; cx++) thumbnail.SetPixel(cx,cy,colorThumb); thumbnail.Apply(); thumbnails[textIndex++] = thumbnail; // thumbnails[textIndex++] = Resources.Load("thumbnails/noThumbs",typeof(Texture2D)) as Texture2D; } } foreach (OSLibTexture tex in module.GetTextureList () ) //Ajout des vignettes des textures { Texture2D thumbnail = tex.GetThumbnail (); nameThumbs[textIndex] = tex.GetText(PlayerPrefs.GetString("language")); if (thumbnail != null) thumbnails[textIndex++] = thumbnail; else thumbnails[textIndex++] = Resources.Load("thumbnails/noThumbs",typeof(Texture2D)) as Texture2D; } /*GUIGridV2*/GUIUpperList thumbGrid = new /*GUIGridV2*/GUIUpperList (1,x, TextManager.GetText(module.GetModuleType ()), "outilOn", "outilOff", this); x++; thumbGrid.setImgContent (thumbnails, nameThumbs, null, null); mapsConfig.addSubItem (thumbGrid); } } //Ajout au rootNode if(modules.GetStandardModuleList().Count > 0) Root.addSubItem(mapsConfig); //Func. speciales components = obj2config.GetComponent<ObjData>().getSpecFcns(); bool bspecFunction = false; for(int i=0; i<components.Length;i++) { Object comp = components[i]; if (comp.GetType().ToString().StartsWith("Function_")) { Function_OS3D funct = (Function_OS3D)comp; /*if(funct.GetFunctionName() == "Reglage plage"){ GUIItemV2 guiItem = new GUIItemV2(2,i+1,TextManager.GetText(funct.GetFunctionParameterName()),"FunctionOn","FunctionOff",this); funct.setGUIItem(guiItem); Root.addSubItem(guiItem); }else{*/ GUIItemV2 guiItem = new GUIItemV2(2,i+1,TextManager.GetText(funct.GetFunctionParameterName()),"outilOn","outilOff",this); funct.setGUIItem(guiItem); specFunctions.addSubItem(guiItem); bspecFunction = true; //} } if (comp.GetType().ToString().StartsWith("FunctionAlt1_")) { Function_OS3D funct = (Function_OS3D)comp; GUIItemV2 guiItem = new GUIItemV2(2,i+1,TextManager.GetText(funct.GetFunctionParameterName()),"outilOn","outilOff",this); funct.setGUIItem(guiItem); specFunctions.addSubItem(guiItem); bspecFunction = true; } if (comp.GetType().ToString().StartsWith("FunctionConf_")) { Function_OS3D funct = (Function_OS3D)comp; GUIItemV2 guiItem = new GUIItemV2(0,i+1,TextManager.GetText(funct.GetFunctionParameterName()),"menuOn","menuOff",this,true); funct.setGUIItem(guiItem); //specFunctions.addSubItem(guiItem); //bspecFunction = true; Root.addSubItem(guiItem); } } //Ajout au rootNode if(bspecFunction) { Root.addSubItem(specFunctions); } showMenu = true; }
//déselectionne l'item sélectionné public void resetSelected() { selectedItm = null; }
// 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; }
public void setSelected(int index) { //selectedItm=(GUIItemV2)subItems[index]; foreach(GUIItemV2 itm in subItems) { if(itm != null && itm.m_actionId == index) { selectedItm = itm; return; } } }
//ajout d'un item public override void addSubItem(GUIItemV2 itm) { subItems.Add(itm); m_subItemsCount ++; updateContent(); }
//----------------------------------------------------- void Start() { originals = GameObject.Find("Originals"); mainNode = GameObject.Find("MainNode"); _interacteur = Camera.main.GetComponent<ObjInteraction>(); menuGroup = new Rect(); SetRects(); othersMenu = new ArrayList(); foreach(Component cp in this.GetComponents<MonoBehaviour>()) { if(cp.GetType() != this.GetType() && cp.GetType().GetInterface("GUIInterface")!= null) { othersMenu.Add(cp); } } //Ajout au Root Root = new GUIItemV2(-1,-1,"Root","","",this); //Title = new GUIItemV2(-1,-1,"Objets","title","title",this); }