public void load(BinaryReader buf)
    {
        _length = buf.ReadSingle();
        _width = buf.ReadSingle();
        _height = buf.ReadSingle();

        _uiLength = (Mathf.RoundToInt(_length*1000)).ToString();
        _uiWidth = (Mathf.RoundToInt(_width*1000)).ToString();
        _uiHeight = (Mathf.RoundToInt(_height*1000)).ToString();

        _type = (PergolaType) buf.ReadInt32();
        _isLengthOriented = buf.ReadBoolean();
        UpdateBladeDir(_isLengthOriented);
        _isFeetVisible = buf.ReadBoolean();

        PergolaAutoFeetEvents.FirePergolaTypeChange(_type.ToString());

        string version = Montage.cdm.versionSave;
        if(LibraryLoader.numVersionInferieur(version,"1.2.95"))
        {
            PergolaAutoFeetEvents.FireBladesDirChange(_isLengthOriented);
        }

        //-----------------OPTIONS-----------------
        int nb = buf.ReadInt32();
        string[] opts = new string[nb];
        for(int i=0;i<nb;i++)
        {
            opts[i] = buf.ReadString();
        }

        foreach(string type in opts)
        {
            if(!GetComponent(type))
            {
                gameObject.AddComponent<FunctionConf_PergolaAutoFeet>();
                //UnityEngineInternal.APIUpdaterRuntimeServices.AddComponent(gameObject, "Assets/Scripts/Pergola/PergolaAutomaticFoot/FunctionConf_PergolaAutoFeet.cs (1793,5)", type);
            }

            //GameObject.AddComponent<T>()
            ((IPergolaAutoFeet) GetComponent(type)).LoadOption(buf);
        }

        BuildIt();
    }
    void OnGUI()
    {
        GUI.skin = _uiSkin;
        //-------vv----FADE Haut-------------vv------------------
        GUI.Box(new Rect(Screen.width-280.0f,0.0f,Screen.width-280.0f,Screen.height),"","BackGround");
        GUILayout.BeginArea(_uiArea);
        GUILayout.FlexibleSpace();
        _uiScroll = GUILayout.BeginScrollView(_uiScroll,"empty","empty",GUILayout.Width(300));//scrollView en cas de menu trop grand
        GUILayout.Box("","UP",GUILayout.Width(280),GUILayout.Height(150));//fade en haut
        GUILayout.BeginVertical("MID");

        //-------vv----UI Configurateur-------vv---------------

        //		//UI Selector
        //		bool tmpSel = GUILayout.Toggle(_uiShowSelector,TextManager.GetText("Pergola.Module"),GUILayout.Height(50),GUILayout.Width(280));
        //		if(tmpSel != _uiShowSelector)
        //		{
        //			_uiShowSelector = tmpSel;
        //			if(_uiShowSelector)
        //				PergolaAutoFeetEvents.FireToggleUIVisibility(_tagSel);
        //			else
        //				ShowSelected();
        //		}
        //
        //		if(_uiShowSelector)
        //		{
        //			GUILayout.BeginHorizontal("","bg",GUILayout.Height(50),GUILayout.Width(280));
        //			GUILayout.FlexibleSpace();
        //
        //			if(_nbLengthModule > 0 && _nbWidthModule > 0)
        //			{
        //				int tmp = GUILayout.SelectionGrid(_selectedModule,_uiModules,_nbLengthModule,selectorStyle);
        //				if(tmp != _selectedModule)
        //				{
        //					_selectedModule = tmp;
        //					ShowSelected();
        //					PergolaAutoFeetEvents.FireSelectedModuleChanged(_selectedModule);
        //					UpdateArrowsPos();
        //				}
        //			}
        //			GUILayout.Space(20);
        //			GUILayout.EndHorizontal();
        //		}

        if(GUILayout.Button(TextManager.GetText("GUIMenuConfiguration.Materials"),"Menu",GUILayout.Height(50),GUILayout.Width(280)))
        {

            GameObject.Find("MainScene").GetComponent<GUIMenuInteraction>().isConfiguring = true;
            Camera.main.GetComponent<ObjInteraction>().setActived(false);
        //			Camera.mainCamera.GetComponent<ObjInteraction>().setSelected(gameObject);
            GameObject.Find("MainScene").GetComponent<GUIMenuConfiguration>().enabled = true;
            GameObject.Find("MainScene").GetComponent<GUIMenuConfiguration>().setVisibility(true);
            GameObject.Find("MainScene").GetComponent<GUIMenuConfiguration>().OpenMaterialTab();

            GameObject.Find("MainScene").GetComponent<GUIMenuLeft>().canDisplay(false);
            GameObject.Find("MainScene").GetComponent<GUIMenuRight>().canDisplay(false);

            enabled = false;

        }

        _showUI = GUILayout.Toggle(_showUI,"Designer","Menu",GUILayout.Height(50),GUILayout.Width(280));

        if(_showUI)
        {
            //UI Dimmensions
            bool tmpDim = GUILayout.Toggle(_uiShowDim,TextManager.GetText("Pergola.Sizes"),GUILayout.Height(50),GUILayout.Width(280));
            if(tmpDim != _uiShowDim)
            {
                _uiShowDim = tmpDim;
                if(_uiShowDim)
                    PergolaAutoFeetEvents.FireToggleUIVisibility(_tagDim);
                else
                    PergolaAutoFeetEvents.FireToggleUIVisibility("close");
            }

            if(_uiShowDim)
            {
                SingleSizeUI(ref _width,ref _uiWidth,widthMin,"Width");

                SingleSizeUI(ref _length,ref _uiLength,lengthMin,"Avance");

                SingleSizeUI(ref _height,ref _uiHeight,heightMin,"Height");
            }

            //UI Type
            bool tmpTyp = GUILayout.Toggle(_uiShowType,TextManager.GetText("Pergola.Type"),GUILayout.Height(50),GUILayout.Width(280));
            if(tmpTyp != _uiShowType)
            {
                _uiShowType = tmpTyp;
                if(_uiShowType)
                    PergolaAutoFeetEvents.FireToggleUIVisibility(_tagTyp);
                else
                    PergolaAutoFeetEvents.FireToggleUIVisibility("close");
            }

            if(_uiShowType)
            {
                GUILayout.BeginHorizontal("","bg",GUILayout.Height(50),GUILayout.Width(280));
                GUILayout.FlexibleSpace();
                PergolaType tmpType = _type;

                if(GUILayout.Button("<","btn<",GUILayout.Height(50),GUILayout.Width(50)))
                {
                    int typ = (int)_type;
                    typ ++;
                    if(typ >= 6)
                        typ = 0;
                    if(typ == 1 /*|| typ == 2*/)
                        typ = 2;
                    _type = (PergolaType)typ;
                }

                GUILayout.Label(GetTypeToString(),"TextField",GUILayout.Height(40),GUILayout.Width(125));

                if(GUILayout.Button(">","btn>",GUILayout.Height(50),GUILayout.Width(50)))
                {
                    int typ = (int)_type;
                    typ --;
                    if(typ < 0)
                        typ = 5;
                    if(typ == 1 /*|| typ == 2*/)
                        typ = 0;
                    _type = (PergolaType)typ;
                }

                if(tmpType != _type)
                {
        //				_type = tmpType;
                    PergolaAutoFeetEvents.FirePergolaTypeChange(_type.ToString());
                    PergolaAutoFeetEvents.FireRebuild();
                }
                GUILayout.Space(20);
                GUILayout.EndHorizontal();
            }

            //UI Foot
            if(_showFeetSwitch)
            {
                bool tmpFet = GUILayout.Toggle(_uiShowFeet,TextManager.GetText("Pergola.Feet"),GUILayout.Height(50),GUILayout.Width(280));
                if(tmpFet != _uiShowFeet)
                {
                    _uiShowFeet = tmpFet;
                    if(_uiShowFeet)
                        PergolaAutoFeetEvents.FireToggleUIVisibility(_tagFet);
                    else
                        PergolaAutoFeetEvents.FireToggleUIVisibility("close");
                }

                if(_uiShowFeet)
                {
                    GUILayout.BeginHorizontal("","bg",GUILayout.Height(50),GUILayout.Width(280));
                    GUILayout.Space(40);
                    GUILayout.FlexibleSpace();
                    string txt="";
                    if(_isFeetVisible)
                        txt = TextManager.GetText("Pergola.Hide");
                    else
                        txt = TextManager.GetText("Pergola.Show");

                    bool tmpFeet = GUILayout.Toggle(_isFeetVisible,txt,"txt",GUILayout.Height(50));
                    if(tmpFeet != _isFeetVisible)
                    {
                        _isFeetVisible = tmpFeet;
                        UpdateFeetVisibility();
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.Space(20);
                    GUILayout.EndHorizontal();
                }
            }
            else
            {
                if(!_isFeetVisible)
                {
                    _isFeetVisible = true;
                    UpdateFeetVisibility();
                }
            }
            //UI Options
            foreach(IPergolaAutoFeet paf in _options)
                paf.GetUI();
        }
        //-------vv----FADE BAS-------------vv------------------
        GUILayout.EndVertical();
        GUILayout.Box("","DWN",GUILayout.Width(280),GUILayout.Height(150));//fade en bas

        GUILayout.EndScrollView();
        GUILayout.FlexibleSpace();

        GUILayout.EndArea();
    }