Beispiel #1
0
 public Block(short x, short y, short z, SHAPE shape, DIRECTION direction, STYLE style)
     : base(x, y, z)
 {
     Shape     = shape;
     Direction = direction;
     Style     = style;
 }
Beispiel #2
0
        private bool AnalysisData()
        {
            if (string.IsNullOrEmpty(this.DataSource))
            {
                return(false);
            }
            if (xmlOperater.LoadXmlContent(this.DataSource) == false)
            {
                return(false);
            }
            XmlNodeList nodeList = xmlOperater.GetNodesByName("Item");

            if (nodeList == null)
            {
                return(false);
            }
            for (int i = 0; i < nodeList.Count; i++)
            {
                XmlNode node = nodeList[i];
                if (node == null)
                {
                    continue;
                }
                XmlAttribute nameAttr = xmlOperater.GetProperCollection(node, "name");
                if (nameAttr == null)
                {
                    continue;
                }
                XmlAttribute typeAttr = xmlOperater.GetProperCollection(node, "type");
                if (typeAttr == null)
                {
                    continue;
                }
                XmlAttribute descAttr = xmlOperater.GetProperCollection(node, "desc");
                if (descAttr == null)
                {
                    continue;
                }
                XmlAttribute styleAttr = xmlOperater.GetProperCollection(node, "style");
                if (styleAttr == null)
                {
                    continue;
                }

                string   name   = nameAttr.Value;
                DATATYPE type   = (DATATYPE)Enum.Parse(typeof(DATATYPE), typeAttr.Value);
                string   desc   = descAttr.Value;
                STYLE    style  = (STYLE)Enum.Parse(typeof(STYLE), styleAttr.Value);
                IGrapTB  grapTb = null;
                if (CreateTbox(name, type, node.InnerXml, style, desc, i, ref grapTb) == false)
                {
                    continue;
                }
                this.textboxList.Add(grapTb);
            }
            return(true);
        }
Beispiel #3
0
 /// <summary>
 /// 手动创建
 /// </summary>
 /// <param name="_images">序列帧图片</param>
 /// <param name="_frameRate">帧率</param>
 /// <param name="_style">类型</param>
 /// <param name="_autoDestroy">结束自动删除</param>
 /// <param name="_playOnAwake">自动播放</param>
 public UGUIAnimation ManualCreate(
     Sprite[] _images, int _frameRate = 30,
     STYLE _style      = STYLE.ONCE,
     bool _autoDestroy = true, bool _playOnAwake = true)
 {
     imageStore  = _images;
     frameRate   = _frameRate;
     style       = _style;
     autoDestroy = _autoDestroy;
     playOnAwake = _playOnAwake;
     return(this);
 }
Beispiel #4
0
    public void Setup(Color _color, STYLE _style = STYLE.NONE, List <Vector3> trajectory = null, string wellname = null, Material _material = null, Material _shadowMaterial = null)
    {
        List <Vector3> points = new List <Vector3>();

        points = new List <Vector3>(trajectory);

        style = _style;

        // Set materials supplied else use default else crash
        if (_material != null)
        {
            mainMaterial = _material;
        }
        if (_shadowMaterial != null)
        {
            shadowMaterial = _material;
        }

        // Always clone the main material so we can modify it without affecting other swatches
        mainMaterial       = Object.Instantiate(mainMaterial) as Material;
        mainMaterial.color = _color;

        // Basic mesh
        if (true)
        {
            main      = gameObject;
            main.name = wellname;
            totalCount++;
            //gameObject.GetComponent<Renderer>().material = mainMaterial;
            GetComponent <Renderer>().material = new Material(Shader.Find("Diffuse"));
            MeshFilter meshFilter = gameObject.GetComponent <MeshFilter>();
            mainMesh = meshFilter.mesh = new Mesh();
        }



        // points.Add(new Vector3(-1000, 0, 0));
        // for (int i = 0; i < 10; i++)
        //  {
        //  points.Add(new Vector3(Random.Range(-1000, 1000), Random.Range(-1000, 1000), Random.Range(-1000, 1000)));


        // }
        // points.Add(new Vector3(1000, 0, 0));

        var path = new SplineCurve3(points);

        TubeGeometry(path, 500, 100, 6);
    }
Beispiel #5
0
        public Button()
        {
            m_TextAlign.Alignment     = StringAlignment.Center;
            m_TextAlign.LineAlignment = StringAlignment.Center;
            m_eMouseUp     = STATE.OFF;
            m_eShape       = SHAPE.RECTANGLE;
            m_eStyle       = STYLE.DRAW;
            m_eValue       = STATE.OFF;
            m_nRound       = 9;
            m_MouseUpColor = Color.OrangeRed;
            m_FillColor    = Color.AliceBlue;
            m_BorderColor  = Color.Blue;
            m_PushColor    = Color.LightGray;

            InitializeComponent();
        }
Beispiel #6
0
    public void Setup(Color _color, STYLE _style = STYLE.NONE, Material _material = null, Material _shadowMaterial = null)
    {
        style = _style;

        // Set materials supplied else use default else crash
        if (_material != null)
        {
            mainMaterial = _material;
        }
        if (_shadowMaterial != null)
        {
            shadowMaterial = _material;
        }

        // Always clone the main material so we can modify it without affecting other swatches
        mainMaterial       = Object.Instantiate(mainMaterial) as Material;
        mainMaterial.color = _color;

        // Basic mesh
        if (true)
        {
            main      = gameObject;
            main.name = "Draw" + totalCount; totalCount++;
            //gameObject.GetComponent<Renderer>().material = mainMaterial;
            GetComponent <Renderer>().material = new Material(Shader.Find("Diffuse"));
            MeshFilter meshFilter = gameObject.GetComponent <MeshFilter>();
            mainMesh = meshFilter.mesh = new Mesh();
        }

        List <Vector3> points = new List <Vector3>();

        points.Add(new Vector3(-1000, 0, 0));
        for (int i = 0; i < 10; i++)
        {
            points.Add(new Vector3(Random.Range(-1000, 1000), Random.Range(-1000, 1000), Random.Range(-1000, 1000)));
        }
        points.Add(new Vector3(1000, 0, 0));

// - rather than doing the above - add the points incrementally if they are far away from previous points over a threshhold
// - i guess i can re-run peuker over the whole thing - it seems deterministic
// - then remake the entire spline
// - and remake the entire tube i guess

        var path = new SplineCurve3(points);

        TubeGeometry(path, 500, 100, 6);
    }
Beispiel #7
0
        private bool CreateTbox(string name, DATATYPE type, string value, STYLE style, string desc, int index, ref IGrapTB grapTb)
        {
            if (IsExistNameInEditor(name) == true)
            {
                return(false);
            }
            if (style == STYLE.EDITOR)
            {
                grapTb = new GrapTBEditor();
            }
            else if (style == STYLE.DEFAULT)
            {
                grapTb = new GrapTB();
            }
            else
            {
                return(false);
            }

            grapTb.Name          = name;
            grapTb.ValueDataType = type;
            grapTb.Value         = value;
            grapTb.Style         = style;
            grapTb.Index         = index;
            grapTb.Desc          = desc;
            double rowthTemp = (1.0 + index) / this.columnNum;

            grapTb.Rowth = (int)Math.Ceiling(rowthTemp);
            int colthTemp = (index + 1) % this.columnNum;

            if (colthTemp == 0)
            {
                grapTb.Colth = this.columnNum;
            }
            else
            {
                grapTb.Colth = colthTemp;
            }
            int x = startPos.X + grapTb.Size.Width * (grapTb.Colth - 1) + (grapTb.Colth - 1) * this.columnInterval;
            int y = startPos.Y + grapTb.Size.Height * (grapTb.Rowth - 1) + (grapTb.Rowth - 1) * this.rowInterval;

            grapTb.Location = new Point(x, y);
            grapTb.PosRect  = new Rectangle(grapTb.Location, grapTb.Size);

            return(true);
        }
Beispiel #8
0
    private void InitConditions()
    {
        print("TDOWN START STATS:\n");
        int weight = Random.Range(0, 10);

        print("Weight: " + weight + "\n");
        if (weight <= 3)
        {
            gameDiff = DIFFICULTY.EASY;
            print("Diff: EASY(0-3)\n");
            velocity   = new Vector2(0.0f, -5.0f);
            minSepTime = 0.9f;
            maxSepTime = 1.7f;
        }
        else if (weight <= 6)
        {
            gameDiff = DIFFICULTY.MEDIUM;
            print("Diff: Medium(4-6)\n");
            velocity   = new Vector2(0.0f, -7.0f);
            minSepTime = 0.6f;
            maxSepTime = 1.4f;
        }
        else if (weight <= 8)
        {
            gameDiff = DIFFICULTY.HARD;
            print("Diff: Hard(7-8)\n");
            velocity   = new Vector2(0.0f, -10.0f);
            minSepTime = 0.3f;
            maxSepTime = 1.1f;
        }
        else
        {
            gameDiff = DIFFICULTY.MAKE_IT_STOP;
            print("Diff: MIS(9)\n");
            velocity   = new Vector2(0.0f, -15.0f);
            minSepTime = 0.1f;
            maxSepTime = 0.9f;
        }
        gameStyle = STYLE.RAIN;
    }
Beispiel #9
0
    // ----------------------------------------------------------------------------------------------------------------------------------------

    // Setup...
    public void setup(Color _color, STYLE _style = STYLE.NONE, Material _material = null, Material _shadowMaterial = null)
    {
        TotalCount++;

        cleanIndex = 0;

        style = _style;

        switch (style)
        {
        case STYLE.RIBBON:
            EnableBottom              = true;
            EnableShadows             = true;
            IncrementalDouglasPeucker = false;
            crossSegments             = 2;
            endCaps       = false;
            rotationStyle = 0;
            break;

        case STYLE.SWATCH:
            EnableBottom              = false;
            EnableShadows             = false;
            IncrementalDouglasPeucker = false;
            crossSegments             = 2;
            endCaps       = false;
            rotationStyle = 0;
            break;

        case STYLE.TUBE:
            EnableBottom              = false;
            EnableShadows             = false;
            IncrementalDouglasPeucker = false;
            crossSegments             = 5;
            endCaps       = true;
            rotationStyle = 0;
            gameObject.GetComponent <Renderer>().castShadows = false;
            //gameObject.renderer.receiveShadows = false;
            break;
        }
        ;

        // Bevel is pre-computed
        initTubeHelper();

        // Set materials supplied else use default else crash
        if (_material != null)
        {
            mainMaterial = _material;
        }
        if (_shadowMaterial != null)
        {
            shadowMaterial = _material;
        }

        // Always clone the main material so we can modify it without affecting other swatches
        mainMaterial       = Object.Instantiate(mainMaterial) as Material;
        mainMaterial.color = _color;

        // Basic mesh
        if (true)
        {
            main      = gameObject;
            main.name = "Draw" + TotalCount;
            main.GetComponent <Renderer>().material = mainMaterial;
            mainMesh = gameObject.GetComponent <MeshFilter>().mesh;
        }

        // Ribbon style renders the bottom separately in order to guarantee mesh normals are independent (due to limits in Unity).
        // NOTE using geometry not shader for backfaces... arguable either way : http://danielbrauer.com/files/rendering-double-sided-geometry.html
        if (EnableBottom)
        {
            bottom = new GameObject("Bottom" + TotalCount);
            bottom.transform.parent = gameObject.transform;
            bottom.AddComponent <MeshFilter>();
            bottom.AddComponent <MeshRenderer>();
            bottom.GetComponent <Renderer>().material = mainMaterial;
            bottomMesh = bottom.GetComponent <MeshFilter>().mesh;
        }

        // some geometries have shadows
        // NOTE a separate geometry object is used for this rather than say tacking some shadow polys onto the end of the main obj geometry
        if (EnableShadows)
        {
            shadow = new GameObject("Shadow" + TotalCount);
            shadow.transform.parent = gameObject.transform;
            shadow.AddComponent <MeshFilter>();
            shadow.AddComponent <MeshRenderer>();
            shadow.GetComponent <Renderer>().material = shadowMaterial;
            shadowMesh = shadow.GetComponent <MeshFilter>().mesh;
        }
    }
        // used for display in spine
        internal void DoTreePainting(CustomDrawNodeIndicatorEventArgs e, ref int rightPos, STYLE style)
        {
            const int sz = 9;

            if (style == STYLE.GROUP)   // fill box
            {
                Rectangle rect = new Rectangle(e.Bounds.Right - rightPos - sz, e.Bounds.Top, sz, sz);
                e.Graphics.FillRectangle(new SolidBrush(buttonColor), rect);
                // to come: paint other shapes (circle, triangle, ...)
            }
            else if (style == STYLE.EXTENSION_ON)   // check
            {
                e.Graphics.DrawLine(new Pen(buttonColor, 2), new Point(e.Bounds.Right - rightPos - sz, e.Bounds.Top + 5), new Point(e.Bounds.Right - rightPos - sz + 4, e.Bounds.Top + sz));
                e.Graphics.DrawLine(new Pen(buttonColor, 2), new Point(e.Bounds.Right - rightPos - sz + 4, e.Bounds.Top + sz), new Point(e.Bounds.Right - rightPos - 1, e.Bounds.Top));
            }
            else if (style == STYLE.EXTENSION_OFF)  // x
            {
                e.Graphics.DrawLine(new Pen(buttonColor, 2), new Point(e.Bounds.Right - rightPos - sz + 2, e.Bounds.Top), new Point(e.Bounds.Right - rightPos - 1, e.Bounds.Top + sz - 2));
                e.Graphics.DrawLine(new Pen(buttonColor, 2), new Point(e.Bounds.Right - rightPos - sz + 2, e.Bounds.Top + sz - 2), new Point(e.Bounds.Right - rightPos - 1, e.Bounds.Top));
            }
            rightPos += sz + 1;
        }
Beispiel #11
0
            static public void DrawCurvedWorldMaterialProperties(MaterialEditor materialEditor, STYLE style, bool drawRenderingOptions, bool drawCull)
            {
                if (drawRenderingOptions && _BlendMode != null)
                {
                    //Make sure that needed setup(ie keywords / renderqueue) are set up if we're switching some existing
                    Material material = materialEditor.target as Material;
                    SetupMaterialWithBlendMode(material, (BlendMode)material.GetFloat("_Mode"));  //If blend modes are not available - use default blend mode
                }

                switch (style)
                {
                case STYLE.HelpBox:
                {
                    using (new AmazingAssets.EditorGUIUtility.EditorGUILayoutBeginVertical(EditorStyles.helpBox))
                    {
                        EditorGUILayout.LabelField(Label.mainGroupName, EditorStyles.boldLabel);

                        if (_CurvedWorldBendSettings != null)
                        {
                            materialEditor.ShaderProperty(_CurvedWorldBendSettings, Label.bendType);
                        }
                    }

                    GUILayout.Space(5);
                }
                break;

                case STYLE.Standard:
                {
                    EditorGUILayout.LabelField(Label.mainGroupName, EditorStyles.boldLabel);

                    if (_CurvedWorldBendSettings != null)
                    {
                        materialEditor.ShaderProperty(_CurvedWorldBendSettings, Label.bendType);
                    }

                    GUILayout.Space(5);
                } break;

                case STYLE.Foldout:
                {
                    foldout = EditorGUILayout.BeginFoldoutHeaderGroup(foldout, Label.mainGroupName);

                    if (foldout)
                    {
                        if (_CurvedWorldBendSettings != null)
                        {
                            materialEditor.ShaderProperty(_CurvedWorldBendSettings, Label.bendType);
                        }

                        GUILayout.Space(5);
                    }

                    EditorGUILayout.EndFoldoutHeaderGroup();
                }
                break;

                case STYLE.None:
                default:
                {
                    if (_CurvedWorldBendSettings != null)
                    {
                        materialEditor.ShaderProperty(_CurvedWorldBendSettings, Label.bendType);
                    }
                }
                break;
                }



                if (drawRenderingOptions && _BlendMode != null)
                {
                    EditorGUI.BeginChangeCheck();
                    {
                        BlendModePopup(materialEditor);
                    }
                    if (EditorGUI.EndChangeCheck())
                    {
                        foreach (var obj in _BlendMode.targets)
                        {
                            Material mat = (Material)obj;
                            SetupMaterialWithBlendMode(mat, (BlendMode)mat.GetFloat("_Mode"));
                        }
                    }
                }

                if (drawCull && _Cull != null)
                {
                    materialEditor.ShaderProperty(_Cull, Label.renderFace);
                }
            }