Beispiel #1
0
	void DoBridge(){
		if(GUILayout.Button("Save group")){
			SanitizeFilename();
			GSD.Roads.GSDRoadUtil.WizardObject WO = new GSD.Roads.GSDRoadUtil.WizardObject();
			WO.ThumbString = ThumbString;
			WO.Desc = Desc;
			WO.DisplayName = tDisplayName;
			WO.FileName = tFilename;
			WO.bIsBridge = bIsBridge;
			WO.bIsDefault = false;

			GSD.Roads.GSDRoadUtil.SaveNodeObjects(ref tSMMs, ref tEOMs, ref WO);
			Close();
		}
	}
    private void LoadObjs(ref string[] tNames, ref string[] tPaths, bool bIsDefault = false)
    {
        int tCount = tNames.Length;
        string tPath = "";
        string tStringPath = "";
        string tDesc = "";
        string tDisplayName = "";
        string ThumbString = "";
        bool bIsBridge = false;
        for(int i=0;i<tCount;i++){
            bIsBridge = false;
            tPath = tPaths[i];

            if(tWindowType == WindowTypeEnum.Extrusion){
                SplinatedMeshMaker.SplinatedMeshLibraryMaker SLM = (SplinatedMeshMaker.SplinatedMeshLibraryMaker)GSDRootUtil.LoadXML<SplinatedMeshMaker.SplinatedMeshLibraryMaker>(ref tPath);
                if(SLM == null){ continue; }
                tStringPath = SLM.CurrentSplinationString;
                tDesc = SLM.Desc;
                tDisplayName = SLM.DisplayName;
                ThumbString = SLM.ThumbString;
                bIsBridge = SLM.bIsBridge;
            }else if(tWindowType == WindowTypeEnum.Edge){
                EdgeObjectMaker.EdgeObjectLibraryMaker ELM = (EdgeObjectMaker.EdgeObjectLibraryMaker)GSDRootUtil.LoadXML<EdgeObjectMaker.EdgeObjectLibraryMaker>(ref tPath);
                if(ELM == null){ continue; }
                tStringPath = ELM.EdgeObjectString;
                tDesc = ELM.Desc;
                tDisplayName = ELM.DisplayName;
                ThumbString = ELM.ThumbString;
                bIsBridge = ELM.bIsBridge;
            }

            //Don't continue if bridge pieces and this is not a bridge piece:
            if(tWindowType == WindowTypeEnum.Extrusion && bIsBridge){ continue; }

            GSDRoadUtil.WizardObject tO = new GSDRoadUtil.WizardObject();
            try{
                tO.Thumb = (Texture2D)AssetDatabase.LoadAssetAtPath(ThumbString,typeof(Texture2D)) as Texture2D;
            }catch{
                tO.Thumb = null;
            }
            if(tO.Thumb == null){
                try{
                    GameObject xObj = (GameObject)UnityEditor.AssetDatabase.LoadAssetAtPath(tStringPath,typeof(GameObject)) as GameObject;
                    tO.Thumb = AssetPreview.GetAssetPreview(xObj);
                }catch{
                    tO.Thumb = null;
                }
            }
            tO.DisplayName = tDisplayName;
            tO.FileName = tNames[i];
            tO.FullPath = tPath;
            tO.Desc = tDesc;
            tO.bIsDefault = bIsDefault;

            if(bIsDefault && tWindowType == WindowTypeEnum.Edge){
                if(tO.DisplayName.Contains("GSDAtten")){
                    tO.DisplayName = "Attenuator";
                    tO.Desc = "Standard double WBeam with impact absorption.";
                }else if(tO.DisplayName.Contains("GSDGreenBlinder")){
                    tO.DisplayName = "KRail Blinder";
                    tO.Desc = "Best results when placed on KRail for KRail blinders.";
                    tO.sortID = 5;
                }else if(tO.DisplayName.Contains("GSDRoadBarrelStatic")){
                    tO.DisplayName = "Sand Barrel Static";
                    tO.Desc = "One static sand barrel. Best results when placed in front of railings or bridges.";
                }else if(tO.DisplayName.Contains("GSDRoadBarrelRigid")){
                    tO.DisplayName = "Sand Barrel Rigid";
                    tO.Desc = "One rigid sand barrel. Best results when placed in front of railings or bridges.";
                }else if(tO.DisplayName.Contains("GSDRoadBarrel3Static")){
                    tO.DisplayName = "Sand Barrels Static 3";
                    tO.Desc = "Three static sand barrels in a line. Best results when placed in front of railings or bridges.";
                }else if(tO.DisplayName.Contains("GSDRoadBarrel3Rigid")){
                    tO.DisplayName = "Sand Barrels Rigid 3";
                    tO.Desc = "Three rigid sand barrels in a line. Best results when placed in front of railings or bridges.";
                }else if(tO.DisplayName.Contains("GSDRoadBarrel7Static")){
                    tO.DisplayName = "Sand Barrels Static 7";
                    tO.Desc = "Seven static sand barrels in standard formation. Best results when placed in front of railings or bridges.";
                }else if(tO.DisplayName.Contains("GSDRoadBarrel7Rigid")){
                    tO.DisplayName = "Sand Barrel Rigid 7";
                    tO.Desc = "Seven rigid sand barrels in standard formation. Best results when placed in front of railings or bridges.";
                }else if(tO.DisplayName.Contains("GSDRoadConBarrelStatic")){
                    tO.DisplayName = "Con Barrels Static";
                    tO.Desc = "Static road construction barrels.";
                    tO.sortID = 3;
                }else if(tO.DisplayName.Contains("GSDRoadConBarrelRigid")){
                    tO.DisplayName = "Con Barrels Rigid";
                    tO.Desc = "Rigid road construction barrels.";
                    tO.sortID = 3;
                }else if(tO.DisplayName.Contains("GSDTrafficConeStatic")){
                    tO.DisplayName = "Traffic cones Static";
                    tO.Desc = "Static traffic cones.";
                    tO.sortID = 4;
                }else if(tO.DisplayName.Contains("GSDTrafficConeRigid")){
                    tO.DisplayName = "Traffic cones Rigid";
                    tO.Desc = "Rigid traffic cones.";
                    tO.sortID = 4;
                }else if(tO.DisplayName.Contains("GSDRoadReflector")){
                    tO.DisplayName = "Road reflectors";
                    tO.Desc = "Placed one center line of road for center line reflection.";
                    tO.sortID = 4;
                }else if(tO.DisplayName.Contains("GSDStopSign")){
                    tO.DisplayName = "Stop sign";
                    tO.Desc = "Standard specification non-interstate stop sign.";
                }else if(tO.DisplayName.Contains("GSDStreetLightSingle")){
                    tO.DisplayName = "Streetlight Singlesided";
                    tO.Desc = "Best used on side of roads.";
                }else if(tO.DisplayName.Contains("GSDStreetLightDouble")){
                    tO.DisplayName = "Streetlight Doublesided";
                    tO.Desc = "Best results when embedded in KRail in centerline of road.";
                }else if(tO.DisplayName.Contains("GSDWarningSign1")){
                    tO.DisplayName = "Warning Sign #1";
                    tO.Desc = "Best results when placed in front of railings or bridges.";
                }else if(tO.DisplayName.Contains("GSDWarningSign2")){
                    tO.DisplayName = "Warning Sign #2";
                    tO.Desc = "Best results when placed in front of railings or bridges.";
                }else if(tO.DisplayName.Contains("GSDSignRightTurnOnly")){
                    tO.DisplayName = "Right turn only";
                    tO.Desc = "Best results when placed near intersection right turn lane.";
                    tO.sortID = 4;
                }

                else if(tO.DisplayName.Contains("GSDSign330")){
                    tO.DisplayName = "Signs 330";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-330\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSign396")){
                    tO.DisplayName = "Signs 396";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-396\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSign617-Small")){
                    tO.DisplayName = "Signs 617 small";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-617\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSign617")){
                    tO.DisplayName = "Signs 617";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-617\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSign861-Small")){
                    tO.DisplayName = "Signs 861 small";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-861\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSign861")){
                    tO.DisplayName = "Sign type 861";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-861\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSign988-Small")){
                    tO.DisplayName = "Signs 988 small";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-988\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSign988")){
                    tO.DisplayName = "Signs 988";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-988\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSignDiamond")){
                    tO.DisplayName = "Signs diamond";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-diamond\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSignSquare-Small")){
                    tO.DisplayName = "Signs square small";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-Square\" as the search term.";
                    tO.sortID = 21;
                }else if(tO.DisplayName.Contains("GSDSignSquare")){
                    tO.DisplayName = "Signs square";
                    tO.Desc = "Interchangeable materials, use \"GSDFedSign-Square\" as the search term.";
                    tO.sortID = 21;
                }
            }

            if(bIsDefault && tWindowType == WindowTypeEnum.Extrusion){
                if(tO.DisplayName.Contains("GSDKRail")){
                    tO.DisplayName = "KRail";
                    tO.Desc = "Federal spec cement KRailing (also known as Jersey Barriers). Variant with down ends.";
                }else if(tO.DisplayName.Contains("GSDKRailCurvedR")){
                    tO.DisplayName = "KRail Curved Right";
                    tO.Desc = "Federal spec cement KRailing (also known as Jersey Barriers). Variant with curved ends for right shoulder.";
                }else if(tO.DisplayName.Contains("GSDKRailCurvedL")){
                    tO.DisplayName = "KRail Curved Left";
                    tO.Desc = "Federal spec cement KRailing (also known as Jersey Barriers). Variant with curved ends for left shoulder.";
                }else if(tO.DisplayName.Contains("GSDWBeam1R")){
                    tO.DisplayName = "WBeam Wood Right";
                    tO.Desc = "Federal spec wooden pole WBeam railing. Best used as outer shoulder railing. Right shoulder.";
                }else if(tO.DisplayName.Contains("GSDWBeam1L")){
                    tO.DisplayName = "WBeam Wood Left";
                    tO.Desc = "Federal spec wooden pole WBeam railing. Best used as outer shoulder railing. Left shoulder.";
                }else if(tO.DisplayName.Contains("GSDWBeam2R")){
                    tO.DisplayName = "WBeam Metal Right";
                    tO.Desc = "Federal spec metal pole WBeam railing. Best used as outer shoulder railing. Right shoulder.";
                }else if(tO.DisplayName.Contains("GSDWBeam2L")){
                    tO.DisplayName = "WBeam Metal Left";
                    tO.Desc = "Federal spec metal pole WBeam railing. Best used as outer shoulder railing. Left shoulder.";
                }else if(tO.DisplayName.Contains("GSDRailing1")){
                    tO.DisplayName = "Railing #1";
                    tO.Desc = "Standard double square pole railing.";
                }else if(tO.DisplayName.Contains("GSDRailing2")){
                    tO.DisplayName = "Railing #2";
                    tO.Desc = "Standard concrete big block railing.";
                }else if(tO.DisplayName.Contains("GSDRailing3")){
                    tO.DisplayName = "Railing #3";
                    tO.Desc = "Standard four-strand metal railing.";
                }else if(tO.DisplayName.Contains("GSDRailing5")){
                    tO.DisplayName = "Railing #5";
                    tO.Desc = "Basic concrete railing with pylons.";
                }else if(tO.DisplayName.Contains("GSDRailing6")){
                    tO.DisplayName = "Railing #6";
                    tO.Desc = "Standard two-strand metal pole railing.";
                }else if(tO.DisplayName.Contains("GSDRailing7")){
                    tO.DisplayName = "Railing #7";
                    tO.Desc = "Rock-decorated concrete railing with pylons and double strand rusted look metal railing.";
                }else if(tO.DisplayName.Contains("GSDRailing8")){
                    tO.DisplayName = "Railing #8";
                    tO.Desc = "Rock-decorated concrete railing with standard single pole metal railing.";
                } else if (tO.DisplayName.Contains("GSDRailing9")) {
                    tO.DisplayName = "Railing #9";
                    tO.Desc = "Very low poly railing used for mobile.";
                } else if (tO.DisplayName.Contains("GSDSidewalk")) {
                    tO.DisplayName = "Sidewalk";
                    tO.Desc = "Sidewalk.";
                }else if(tO.DisplayName.Contains("GSDRumbleStrip")){
                    tO.DisplayName = "Rumblestrip";
                    tO.Desc = "State spec rumblestrip. For best results place several cm from road edge into shoulder.";
                }else if(tO.DisplayName.Contains("GSDRailing4R")){
                    tO.DisplayName = "Railing #4 Right";
                    tO.Desc = "Three bar angled pole railing. Right side of road.";
                }else if(tO.DisplayName.Contains("GSDRailing4L")){
                    tO.DisplayName = "Railing #4 Left";
                    tO.Desc = "Three bar angled pole railing. Left side of road.";
                }else if(tO.DisplayName.Contains("GSDRailing4-LightR")){
                    tO.DisplayName = "Railing #4 Light Right";
                    tO.Desc = "Three bar angled pole railing. Right side of road. Light version with fewer triangle count.";
                }else if(tO.DisplayName.Contains("GSDRailing4-LightL")){
                    tO.DisplayName = "Railing #4 Light Left";
                    tO.Desc = "Three bar angled pole railing. Left side of road. Light version with fewer triangle count.";
                }else if(tO.DisplayName.Contains("GSDRailingBase1")){
                    tO.DisplayName = "Railing base #1";
                    tO.Desc = "Use as a base on other railings to create more detail.";
                }else if(tO.DisplayName.Contains("GSDRailingBase2")){
                    tO.DisplayName = "Railing base #2";
                    tO.Desc = "Use as a base on other railings to create more detail.";
                }else if(tO.DisplayName.Contains("GSDCableBarrier-Light")){
                    tO.DisplayName = "Cable barrier 10m";
                    tO.Desc = "Cable barrier 10m light triangle version. Best used as center divider or as railing barriers.";
                    tO.sortID = 20;
                }else if(tO.DisplayName.Contains("GSDCableBarrier")){
                    tO.DisplayName = "Cable barrier 5m";
                    tO.Desc = "Cable barrier 5m. Best used as center divider or as railing barriers.";
                    tO.sortID = 20;
                }
            }

            oList.Add(tO);
        }
        oListSort();
    }