コード例 #1
0
        /*
         * This routine is used to invert the hole points, specifically the 'Y' points.
         * The html canvas has 0,0 at the upper left and 'Y' goes down. For the holegroup canvas
         * we want a 'Y' that goes up, because that's how the holes are overlaid and appear in
         * three dimensions, and how we think of them intuitively. To manage this we'll simply flip the
         * Y points for the duration of the time that they are being edited and reflip them when its time to save
         */
        public void InvertHolePoints()
        {
            for (int i = 0; i < HoleGroupList.Count; i++)
            {
                HoleGroup hg = HoleGroupList.GetFrom(i);

                for (int j = 0; j < hg.HoleList.Length; j++)
                {
                    /*
                     * For all hole types the offset Y is inverted
                     */
                    LayoutHole oHole = hg.HoleList[j];
                    oHole.OffsetY = -oHole.OffsetY;

                    /*
                     * For polygon hole types the individual Y's are inverted
                     */
                    if (oHole.HoleType == "poly")
                    {
                        BoundaryPolygon oPolygon = BoundaryPolygonList.GetFrom(oHole.HoleTypeIndex);
                        for (int k = 0; k < oPolygon.PointList.Length; k++)
                        {
                            Point3D p = oPolygon.PointList[k];
                            p.Y = -p.Y;
                        }
                    }
                }
            }
        }
コード例 #2
0
        public void AddHoleGroup(string HoleGroupID)
        {
            HoleGroup hg = new HoleGroup();

            hg.HoleGroupID = HoleGroupID;
            hg.HoleList    = new LayoutHole[0];

            HoleGroupList.Add(hg);
        }
コード例 #3
0
        public void RemoveHoleFromHoleGroup(HoleGroup hg, int index)
        {
#if DOTNET
            List <LayoutHole> tmp = new List <LayoutHole>(hg.HoleList);
            tmp.RemoveAt(index);
            hg.HoleList = tmp.ToArray();
#else
            hg.HoleList.splice(index, 1);
#endif
        }
コード例 #4
0
        public void AddHoleToHoleGroup(HoleGroup hg, LayoutHole oNewHole)
        {
#if DOTNET
            List <LayoutHole> tmp = new List <LayoutHole>(hg.HoleList);
            tmp.Add(oNewHole);
            hg.HoleList = tmp.ToArray();
#else
            hg.HoleList.push(oNewHole);
#endif
        }
コード例 #5
0
 public void SelectHoleGroup(string name)
 {
     for (int i = 0; i < HoleGroupList.Count; i++)
     {
         HoleGroup hg = HoleGroupList.GetFrom(i);
         if (hg.HoleGroupID == name)
         {
             MostRecentlySelectedHoleGroup = hg;
             return;
         }
     }
 }
コード例 #6
0
        public void LoadFromJSON(
            HoleGroup[] HoleGroupArray,
            BoundaryRectangle[] RectangleArray,
            BoundaryEllipse[] EllipseArray,
            BoundaryPolygon[] PolygonArray)
        {
            HoleGroupList = new List <HoleGroup>();
            for (int i = 0; i < HoleGroupArray.Length; i++)
            {
                HoleGroup hg = new HoleGroup();

                hg.HoleGroupID = HoleGroupArray[i].HoleGroupID;

                /*
                 * When the objects get here in JS the holelist is no longer a list type, its an array type because
                 * of serialization.
                 */
                int len = GetHoleListLength(HoleGroupArray[i].HoleList);
                for (int j = 0; j < len; j++)
                {
                    LayoutHole oHoleToAdd = HoleGroupArray[i].HoleList[j];

                    AddHoleToHoleGroup(hg, oHoleToAdd);
                }

                HoleGroupList.Add(hg);
            }

            BoundaryRectangleList = new List <BoundaryRectangle>();
            for (int i = 0; i < RectangleArray.Length; i++)
            {
                BoundaryRectangleList.Add(RectangleArray[i]);
            }

            BoundaryEllipseList = new List <BoundaryEllipse>();
            for (int i = 0; i < EllipseArray.Length; i++)
            {
                BoundaryEllipseList.Add(EllipseArray[i]);
            }

            BoundaryPolygonList = new List <BoundaryPolygon>();
            for (int i = 0; i < PolygonArray.Length; i++)
            {
                BoundaryPolygonList.Add(PolygonArray[i]);
            }

            /*
             * Now flip all of the Y points so that positive Y values go 'up'
             */
            InvertHolePoints();
        }
コード例 #7
0
    Dictionary <int, GameObject> fenches = new Dictionary <int, GameObject>();    //存放fenches的对象

    void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            //Instance.Init();
            Destroy(gameObject);
        }

        //Init();
        //DontDestroyOnLoad(gameObject);    //防止restart时自身被销毁
    }
コード例 #8
0
 void DeleteHoleGroup(string HoleGroupID)
 {
     for (int i = 0; i < HoleGroupList.Count; i++)
     {
         HoleGroup hg = HoleGroupList.GetFrom(i);
         if (hg.HoleGroupID == HoleGroupID)
         {
             HoleGroupList.RemoveAt(i);
             MostRecentlySelectedHole               = null;
             MostRecentlySelectedHoleGroup          = null;
             MostRecentlySelectedPolygonEdgeIndex   = -1;
             MostRecentlySelectedPolygonVertexIndex = -1;
             return;
         }
     }
 }
コード例 #9
0
 public void AddHoleToHoleList(HoleGroup hg, Hole oNewHole)
 {
 }
コード例 #10
0
ファイル: HoleGroupController.cs プロジェクト: PeachT/KVM2018
 public IActionResult Put(string id, HoleGroup data)
 {
     return(Json(_col.UpData(id, data)));
 }
コード例 #11
0
ファイル: HoleGroupController.cs プロジェクト: PeachT/KVM2018
 public IActionResult Post(HoleGroup data)
 {
     data.Id = Guid.NewGuid().ToString();
     return(Json(_col.Insert(data)));
 }