コード例 #1
0
ファイル: Menu.cs プロジェクト: Alan-Baylis/ManafestSandbox
    public static Color BoxColor(string state)
    {
        Vector3 rgb = new Vector3();

        switch (state)
        {
        case "normal":        rgb = new Vector3(0.211f, 0.219f, 0.349f); break;

        case "pressed":       rgb = new Vector3(0.090f, 0.101f, 0.227f); break;

        case "hover":         rgb = new Vector3(0.203f, 0.207f, 0.258f); break;

        case "disabled":      rgb = new Vector3(0.466f, 0.470f, 0.513f); break;

        case "completion":    rgb = new Vector3(0.090f, 0.101f, 0.227f); break;

        case "panel":         rgb = new Vector3(0.466f, 0.470f, 0.513f); break;

        case "focus":         rgb = new Vector3(0.211f, 0.219f, 0.349f); break;

        case "read_only":     rgb = new Vector3(0.211f, 0.219f, 0.349f); break;

        case "slider":        rgb = new Vector3(0.211f, 0.219f, 0.349f); break;

        case "grabber_area":  rgb = new Vector3(0.211f, 0.219f, 0.349f); break;

        case "editable":  rgb = new Vector3(0.466f, 0.470f, 0.513f); break;

        case "background":  rgb = new Vector3(0.086f, 0.086f, 0.172f); break;
        }

        return(GFX.Color(rgb));
    }
コード例 #2
0
ファイル: Menu.cs プロジェクト: Alan-Baylis/ManafestSandbox
    public static Button Button(string text = "", Action onClick = null)
    {
        Button button = new Button();

        if (text != "")
        {
            button.SetText(text);
        }
        if (onClick != null)
        {
            button.SetOnClick(onClick);
        }


        button.AddStyleboxOverride("normal", ColorStyleBox("normal"));
        button.AddStyleboxOverride("pressed", ColorStyleBox("pressed"));
        button.AddStyleboxOverride("hover", ColorStyleBox("hover"));
        button.AddStyleboxOverride("disabled", ColorStyleBox("disabled"));

        button.AddColorOverride("font_color", GFX.Color(new Vector3()));
        button.AddColorOverride("font_color_pressed", GFX.Color(new Vector3()));
        button.AddColorOverride("font_color_hover", GFX.Color(new Vector3()));
        button.AddColorOverride("font_color_disabled", GFX.Color(new Vector3()));

        return(button);
    }
コード例 #3
0
ファイル: Menu.cs プロジェクト: Alan-Baylis/ManafestSandbox
    public static StyleBox ColorStyleBox(Color bgColor)
    {
        StyleBoxFlat box = new StyleBoxFlat();

        box.BgColor     = bgColor;
        box.BorderColor = GFX.Color(new Vector3());
        int border = 5;

        box.BorderWidthLeft   = border;
        box.BorderWidthRight  = border;
        box.BorderWidthTop    = border;
        box.BorderWidthBottom = border;
        return(box);
    }
コード例 #4
0
    public void InitTerrain(string terrainFile)
    {
        PackedScene ps       = (PackedScene)GD.Load(terrainFile);
        Node        instance = ps.Instance();

        AddChild(instance);
        terrain = (Spatial)instance;

        // Everything below this line is a dirty hack to work around a bug.
        GridMap gm = Util.GetChildByName(terrain, "Map") as GridMap;

        MeshLibrary    theme  = gm.Theme;
        List <Vector3> colors = new List <Vector3> {
            new Vector3(0.537f, 0.101f, 0.101f),
            new Vector3(0.141f, 0.313f, 0.125f),
            new Vector3(0.137f, 0.215f, 0.521f),
            new Vector3(0.690f, 0.321f, 0.129f),
            new Vector3(0.490f, 0.168f, 0.490f),
            new Vector3(0.717f, 0.694f, 0.203f),
            new Vector3(1, 1, 1),
            new Vector3(0, 0, 0)
        };

        for (int i = 0; i < 8; i++)
        {
            ArrayMesh       arrMesh  = theme.GetItemMesh(i) as ArrayMesh;
            SpatialMaterial material = GFX.GetColorSpatialMaterial(colors[i]) as SpatialMaterial;

            material.EmissionEnabled = true;
            material.Emission        = GFX.Color(colors[i]);
            material.EmissionEnergy  = 0.5f;

            material.TransmissionEnabled = true;
            material.Transmission        = GFX.Color(colors[i]);

            material.RefractionEnabled = false;

            material.Metallic = 1f;

            material.Roughness = 0.5f;

            arrMesh.SurfaceSetMaterial(0, material);
        }
    }