Example #1
0
 public static iGUICode_RootSliderOBS Create_GuiSlider(iGUICode_RootPanelOBS oPanel, int nOrdinal, FieldInfo oFieldInfo)
 {
     GameObject oSliderResGO =  Resources.Load("GUI-Panel/iGUICode_RootSlider") as GameObject;
     GameObject oNodeSliderGO = GameObject.Instantiate(oSliderResGO) as GameObject;
     iGUICode_RootSliderOBS oSlider = oNodeSliderGO.GetComponent<iGUICode_RootSliderOBS>();
     oSlider.Initialize(oPanel, nOrdinal, oFieldInfo);
     return oSlider;
 }
Example #2
0
    public void Initialize(iGUICode_RootPanelOBS oPanel, int nOrdinal, FieldInfo oFieldInfo)
    {
        _oPanel 	= oPanel;
        _nOrdinal 	= nOrdinal;
        _oFieldInfo = oFieldInfo;

        transform.name = "iGUICode_RootSlider_" + oFieldInfo.Name;
        transform.parent = _oPanel.transform;
        transform.localPosition = new Vector3(0.01f, -_nOrdinal*C_SliderHeight-iGUICode_RootPanelOBS.C_HeaderTextHeight, 0);
        transform.localRotation = Quaternion.Euler(0, -90f, 0);						//**WEAK: Another annoying init rotation... fix this in 3dsMax??
        _oNodeSlide = transform.FindChild("Slide");
        _oTextMesh  = transform.FindChild("Text").GetComponent<TextMesh>();			//###WEAK: A bit of duplication with CCursor... create base class??
        gameObject.layer = CCursor.C_Layer_HotSpot;

        BoxCollider oColBox = (BoxCollider)transform.GetComponent<Collider>();
        oColBox.center  = new Vector3(0, 0, C_SliderSize/2);// + C_SliderMin*2 + C_SlideSize/2);
        oColBox.size	= new Vector3(0.02f, 0.02f, .2f); 							// We give it some 'depth' so slider collider can 'poke through' panel collider and get mouse events

        SetSlidePos_FromValue((float)_oFieldInfo.GetValue(_oPanel._oHotSpot._oEditingObject));
    }