Exemplo n.º 1
0
            /// <summary>
            /// Renders Collection Modifiers
            /// </summary>
            protected override void RenderModifiers(Int32 id)
            {
                // Index
                index++;

                // Add Biomes
                Button(Localization.LOC_KITTOPIATECH_LANDCLASSWINDOW_ADD, () =>
                {
                    Object landClass_ = null;
                    if (Collection is IEnumerable <PQSMod_VertexPlanet.LandClass> )
                    {
                        landClass_ = new PQSMod_VertexPlanet.LandClass("LandClass", 0, 0, new Color(), new Color(), 0);
                        (landClass_ as PQSMod_VertexPlanet.LandClass).colorNoiseMap = new PQSMod_VertexPlanet.SimplexWrapper(0, 0, 0, 0);
                    }
                    if (Collection is IEnumerable <PQSMod_HeightColorMap.LandClass> )
                    {
                        landClass_ = new PQSMod_HeightColorMap.LandClass("LandClass", 0, 0, new Color(), new Color(), 0);
                    }
                    if (Collection is IEnumerable <PQSMod_HeightColorMap2.LandClass> )
                    {
                        landClass_ = new PQSMod_HeightColorMap2.LandClass("LandClass", 0, 0, new Color(), new Color(), 0);
                    }
                    if (Collection is IEnumerable <PQSMod_HeightColorMapNoise.LandClass> )
                    {
                        landClass_ = new PQSMod_HeightColorMapNoise.LandClass("LandClass", 0, 0, new Color(), new Color(), 0);
                    }
                    if (Collection is IEnumerable <PQSLandControl.LandClass> )
                    {
                        PQSLandControl.LandClass landClass = new PQSLandControl.LandClass();
                        PQSLandControl.LerpRange range;

                        // Initialize default parameters
                        landClass.altDelta            = 1;
                        landClass.color               = new Color(0, 0, 0, 0);
                        landClass.coverageFrequency   = 1;
                        landClass.coverageOctaves     = 1;
                        landClass.coveragePersistance = 1;
                        landClass.coverageSeed        = 1;
                        landClass.landClassName       = "Base";
                        landClass.latDelta            = 1;
                        landClass.lonDelta            = 1;
                        landClass.noiseColor          = new Color(0, 0, 0, 0);
                        landClass.noiseFrequency      = 1;
                        landClass.noiseOctaves        = 1;
                        landClass.noisePersistance    = 1;
                        landClass.noiseSeed           = 1;

                        range                   = new PQSLandControl.LerpRange();
                        range.endEnd            = 1;
                        range.endStart          = 1;
                        range.startEnd          = 0;
                        range.startStart        = 0;
                        landClass.altitudeRange = range;

                        range                   = new PQSLandControl.LerpRange();
                        range.endEnd            = 1;
                        range.endStart          = 1;
                        range.startEnd          = 0;
                        range.startStart        = 0;
                        landClass.latitudeRange = range;

                        range            = new PQSLandControl.LerpRange();
                        range.endEnd     = 1;
                        range.endStart   = 1;
                        range.startEnd   = 0;
                        range.startStart = 0;
                        landClass.latitudeDoubleRange = range;

                        range                    = new PQSLandControl.LerpRange();
                        range.endEnd             = 2;
                        range.endStart           = 2;
                        range.startEnd           = -1;
                        range.startStart         = -1;
                        landClass.longitudeRange = range;

                        landClass_ = landClass;
                    }
                    List <Object> collection = Collection.ToList();
                    collection.Add(landClass_);
                    Collection = collection;
                    Callback(Collection);
                });
            }
Exemplo n.º 2
0
 // Runtime constructor
 public LandClassLoader(PQSMod_VertexPlanet.LandClass land)
 {
     landClass     = land;
     colorNoiseMap = new SimplexWrapper(landClass.colorNoiseMap);
 }
        void LandClassWindowFunc( int windowID )
        {
            int yoffset = 30;
            scrollposition3 = GUI.BeginScrollView( new Rect( 0, 30, 300, 250 ), scrollposition3,new Rect( 0,0,400,10000));
            if( landmodder_mode == 0 ) //PQSLandControl
            {
                if( landmodder_state == 0 )
                {
                    foreach( PQSLandControl.LandClass lc_Mod in LandclassestoMod)
                    {
                        if(GUI.Button( new Rect( 20, yoffset, 200, 20 ), ""+lc_Mod.landClassName ))
                        {
                            landclasstoMod = lc_Mod;
                            landmodder_state = 1;
                        }
                        yoffset += 30;
                    }
                }
                if( landmodder_state == 1 )
                {
                    foreach( FieldInfo key in landclasstoMod.GetType().GetFields() )
                    {
                    try{
                    System.Object obj = (System.Object)landclasstoMod;
                    if( key.GetValue(obj).GetType() == typeof( string ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) );
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( bool ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, GUI.Toggle( new Rect( 200 , yoffset, 200, 20 ), (bool)key.GetValue(obj), "Bool" ));
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( int ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, (int)StrToFloat( GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) ));
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( float ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, StrToFloat( GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) ));
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( double ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, (double)StrToFloat( GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) ));
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( Color ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 100, 20), ""+key.Name );
                        if( GUI.Button( new Rect( 150 , yoffset, 50, 20), "Edit" ) )
                        {
                            Color getColour;
                            getColour = (Color)key.GetValue(obj);
                            rVal = getColour.r;
                            gVal = getColour.g;
                            bVal = getColour.b;
                            aVal = getColour.a;

                            objToEdit = obj;
                            KeyToEdit = key;

                            isshowingColourEditor = true;
                        }
                        //key.SetValue( obj, (double)StrToFloat( GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) ));
                        yoffset += 30;
                    }
                    }catch{}
                }
                yoffset += 30;
                }
            }
            else
            {
                if( landmodder_state == 0 )
                {
                    foreach( PQSMod_VertexPlanet.LandClass lc_Mod in VertexLandclassestoMod)
                    {
                        if(GUI.Button( new Rect( 20, yoffset, 200, 20 ), ""+lc_Mod.name ))
                        {
                            VertexLandclasstoMod = lc_Mod;
                            landmodder_state = 1;
                        }
                        yoffset += 30;
                    }
                }
                if( landmodder_state == 1 )
                {
                    foreach( FieldInfo key in VertexLandclasstoMod.GetType().GetFields() )
                    {
                    try{
                    System.Object obj = (System.Object)VertexLandclasstoMod;
                    if( key.GetValue(obj).GetType() == typeof( string ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) );
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( bool ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, GUI.Toggle( new Rect( 200 , yoffset, 200, 20 ), (bool)key.GetValue(obj), "Bool" ));
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( int ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, (int)StrToFloat( GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) ));
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( float ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, StrToFloat( GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) ));
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( double ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 200, 20), ""+key.Name );
                        key.SetValue( obj, (double)StrToFloat( GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) ));
                        yoffset += 30;
                    }
                    else if( key.GetValue(obj).GetType() == typeof( Color ))
                    {
                        GUI.Label( new Rect( 20 , yoffset, 100, 20), ""+key.Name );
                        if( GUI.Button( new Rect( 150 , yoffset, 50, 20), "Edit" ) )
                        {
                            Color getColour;
                            getColour = (Color)key.GetValue(obj);
                            rVal = getColour.r;
                            gVal = getColour.g;
                            bVal = getColour.b;
                            aVal = getColour.a;

                            objToEdit = obj;
                            KeyToEdit = key;

                            isshowingColourEditor = true;
                        }
                        //key.SetValue( obj, (double)StrToFloat( GUI.TextField( new Rect( 200 , yoffset, 200, 20), ""+key.GetValue(obj) ) ));
                        yoffset += 30;
                    }
                    }catch{}
                }
                yoffset += 30;
                }
            }

            yoffset += 30;

            if( GUI.Button( new Rect( 20, yoffset, 200, 20 ), "Exit" ) )
            {
                showLandClassmenu = false;
                landmodder_state = 0;
            }
            GUI.EndScrollView();

            GUI.DragWindow();
        }
Exemplo n.º 4
0
 // Default constructor
 public LandClassLoader()
 {
     landClass = new PQSMod_VertexPlanet.LandClass("class", 0.0, 0.0, Color.white, Color.white, 0.0);
 }
Exemplo n.º 5
0
 public LandClassWrapper()
 {
     // Initialize the land class
     landClass = new PQSMod_VertexPlanet.LandClass("class", 0.0, 0.0, Color.white, Color.white, 0.0);
 }