예제 #1
0
파일: Mouse.cs 프로젝트: kokose1234/HaSuite
 public void SetRandomTilesMode(TileInfo[] tileList)
 {
     lock (Board.ParentControl)
     {
         Clear();
         tileRandomList = tileList;
         SetHeldInfo(tileRandomList[NextInt32(tileRandomList.Length)]);
         state = MouseState.RandomTiles;
     }
 }
예제 #2
0
 private static void MoveFootholdX(TileInfo result, bool first, bool left, int width)
 {
     if (result.footholdOffsets.Count < 1)
         return;
     int idx = first ? 0 : result.footholdOffsets.Count - 1;
     int x = left ? 0 : (width * result.mag);
     if (result.footholdOffsets[idx].X != x)
     {
         result.footholdOffsets[idx] = new XNA.Point(x, result.footholdOffsets[idx].Y);
     }
 }
예제 #3
0
 private static void MoveFootholdY(TileInfo result, bool first, bool top, int height)
 {
     if (result.footholdOffsets.Count < 1)
         return;
     int idx = first ? 0 : result.footholdOffsets.Count - 1;
     int y = top ? 0 : (height * result.mag);
     if (result.footholdOffsets[idx].Y != y)
     {
         result.footholdOffsets[idx] = new XNA.Point(result.footholdOffsets[idx].X, y);
     }
 }
예제 #4
0
 private static TileInfo Load(WzCanvasProperty parentObject, string tS, string u, string no, int? mag)
 {
     WzImageProperty zProp = parentObject["z"];
     int z = zProp == null ? 0 : InfoTool.GetInt(zProp);
     TileInfo result = new TileInfo(parentObject.PngProperty.GetPNG(false), WzInfoTools.VectorToSystemPoint((WzVectorProperty)parentObject["origin"]), tS, u, no, mag.HasValue ? mag.Value : 1, z, parentObject);
     WzConvexProperty footholds = (WzConvexProperty)parentObject["foothold"];
     if (footholds != null)
         foreach (WzVectorProperty foothold in footholds.WzProperties)
             result.footholdOffsets.Add(WzInfoTools.VectorToXNAPoint(foothold));
     if (UserSettings.FixFootholdMispositions)
     {
         FixFootholdMispositions(result);
     }
     return result;
 }
예제 #5
0
        /* The sole reason behind this function's existence is that Nexon's designers are a bunch of incompetent goons.

         * In a nutshell, some tiles (mostly old ones) have innate footholds that do not overlap when snapping them to each other, causing a weird foothold structure.
         * I do not know how Nexon's editor overcame this; I am assuming they manually connected the footholds to sort that out. However, since HaCreator only allows automatic
         * connection of footholds, we need to sort these cases out preemptively here.
        */
        private static void FixFootholdMispositions(TileInfo result)
        {
            switch (result.u)
            {
                case "enV0":
                    MoveFootholdY(result, true, false, 60);
                    MoveFootholdY(result, false, true, 60);
                    break;
                case "enV1":
                    MoveFootholdY(result, true, true, 60);
                    MoveFootholdY(result, false, false, 60);
                    break;
                case "enH0":
                    MoveFootholdX(result, true, true, 90);
                    MoveFootholdX(result, false, false, 90);
                    break;
                case "slLU":
                    MoveFootholdX(result, true, false, -90);
                    MoveFootholdX(result, false, true, -90);
                    break;
                case "slRU":
                    MoveFootholdX(result, true, true, 90);
                    MoveFootholdX(result, false, false, 90);
                    break;
                case "edU":
                    MoveFootholdY(result, true, false, 0);
                    MoveFootholdY(result, false, false, 0);
                    break;
            }
        }
예제 #6
0
 public TileInstance(Board board, SerializationForm json)
     : base(board, json)
 {
     baseInfo = TileInfo.Get(json.ts, json.u, json.no);
 }
예제 #7
0
 public TileInstance(TileInfo baseInfo, Layer layer, Board board, int x, int y, int z, int zM)
     : base(board, layer, zM, x, y, z)
 {
     this.baseInfo = baseInfo;
     AttachToLayer(layer);
 }
예제 #8
0
 // Only to be used by layer TS changing, do not use this for ANYTHING else.
 public void SetBaseInfo(TileInfo newInfo)
 {
     this.baseInfo = newInfo;
 }