Пример #1
0
        // draw the point,besides,show/hide the rotation object
        void    DrawPoint(int x, int y)
        {
            var pname = DemoMenuItems.PointName(x, y);

            // inspector
            DrawPointInspector(x, y, pname);
        }
Пример #2
0
        // retrieve data from transform.
        void RetrievePointData(int x, int y)
        {
            string pointname = DemoMenuItems.PointName(x, y);

            if (findwall.transform.FindChild(pointname))
            {
                findwall.walldata.points[x, y] = true;
            }
            else
            {
                findwall.walldata.points[x, y] = false;
            }
        }
Пример #3
0
        private bool LoadPointFromProfile(FWallView wall, int idx, int x, int y)
        {
            var fn     = DemoMenuItems.PointName(x, y);
            var pt     = wall.transform.FindChild(fn);
            var schema = currentData.walls[idx].schema[x, y];

            if (!pt)
            {
                schema.state = Data.DataPointState.eNone;
                return(false);
            }
            var pi = pt.gameObject.GetComponent <FPointView>();

            schema.state   = Data.DataPointState.eProfiled;
            schema.distort = pi.ViewTrans;
            schema.easy    = pi.ViewParts;
            return(true);
        }
Пример #4
0
        void    DrawPointInspector(int x, int y, string pointname)
        {
            float  left     = rectSize * x;
            float  top      = rectSize * y;
            Color  guicolor = GUI.color;
            string info     = "";

            if (findwall.walldata.points[x, y])
            {
                info = "V";
            }
            else
            {
                var c = GUI.color;
                c.a       = 0;
                GUI.color = c;
            }

            if (GUI.Button(new Rect(guiCurrentRect.xMin + left + 1
                                    , guiCurrentRect.yMin + top + 1
                                    , rectSize - 2, rectSize - 2)
                           , info))
            {
                var pname = DemoMenuItems.PointName(x, y);
                var t     = findwall.transform.FindChild(pname);
                if (t)
                {
                    Undo.DestroyObjectImmediate(t.gameObject);
                }
                else
                {
                    // process add new point
                    var g = DemoMenuItems.CreatePointObject(x, y
                                                            , findwall.gameObject);
                    Undo.RegisterCreatedObjectUndo(g, "new point");
                }
            }
            GUI.color = guicolor;
        }