94 lines
4.1 KiB
C#
94 lines
4.1 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Services;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
// 定義與前端一致的元素結構
|
|
public class TabletElement
|
|
{
|
|
public string id { get; set; }
|
|
public string type { get; set; }
|
|
public string text { get; set; }
|
|
public double x { get; set; }
|
|
public double y { get; set; }
|
|
public double? width { get; set; }
|
|
public double? height { get; set; }
|
|
public ElementStyle style { get; set; }
|
|
public string hidden { get; set; }
|
|
public double? twoOffset { get; set; }
|
|
public double? threeOffset { get; set; }
|
|
public double? fourOffset { get; set; }
|
|
public int? breakLen { get; set; }
|
|
}
|
|
|
|
public class ElementStyle
|
|
{
|
|
public double fontSize { get; set; }
|
|
public string fontFamily { get; set; }
|
|
public bool isVertical { get; set; }
|
|
public double letterSpacing { get; set; }
|
|
public double lineHeight { get; set; }
|
|
public double? itemSpacing { get; set; }
|
|
public string visibility { get; set; }
|
|
}
|
|
|
|
public partial class admin_item_TabletDesigner :MyWeb.config
|
|
{
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
[WebMethod]
|
|
public static string GetConfig()
|
|
{
|
|
// 模擬原本的 GetConfig() 行為
|
|
var config = new
|
|
{
|
|
elements = new List<TabletElement> {
|
|
new TabletElement {
|
|
id = "address", type = "address", text = "台中市潭子區中山路", x = 160, y = 80,
|
|
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5,visibility="" }
|
|
},
|
|
new TabletElement {
|
|
id = "title1", type = "ancestor", text = "牌位正名", x = 130, y = 80,
|
|
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
|
|
},
|
|
new TabletElement {
|
|
id = "lefttitle", type = "ancestor", text = "左正名", x = 10, y = 80,
|
|
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
|
|
},
|
|
new TabletElement {
|
|
id = "righttitle", type = "ancestor", text = "右正名", x = 50, y = 80,
|
|
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
|
|
},
|
|
new TabletElement {
|
|
id = "titletriangle", type = "roster", text = "張一\n李二\n陳三\n吳四\n劉五\n趙六\n林七\n徐八", x = 10, y = 80,
|
|
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5,visibility="" }
|
|
},
|
|
new TabletElement
|
|
{
|
|
id="tricombined",type="combined-center",text="林張吳\n氏歷代祖先", x = 10, y = 80,
|
|
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
|
|
},
|
|
new TabletElement
|
|
{
|
|
id="combined",type="combined-center",text="李王\n氏歷代祖先", x = 10, y = 80,
|
|
style = new ElementStyle { fontSize = 24, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
|
|
},
|
|
new TabletElement
|
|
{
|
|
id="alive",type="alive",text="陽上名字", x = 60, y = 200,
|
|
style = new ElementStyle { fontSize = 18, fontFamily = "Kaiti", isVertical = true, letterSpacing = 5, lineHeight = 1.5 ,visibility="" }
|
|
}
|
|
},
|
|
paper = new { width = 100, height = 272, name = "Yellow" }
|
|
};
|
|
return JsonConvert.SerializeObject(config);
|
|
}
|
|
} |