//从json读取游戏关卡 public void stageLevel(string json) { LevelData data = LevelData.CreateFromJSON(json); int size = data.size; string color = data.color; max_step = data.step; string colorback = data.colorback; string colorleft = data.colorleft; string colorright = data.colorright; string colortop = data.colortop; string colorbottom = data.colorbottom; List <int> colorlist = new List <int>(); List <int> color_left = new List <int>(); List <int> color_right = new List <int>(); List <int> color_top = new List <int>(); List <int> color_bottom = new List <int>(); List <int> color_back = new List <int>(); for (int i = 0; i < color.Length; i++) { colorlist.Add(color[i] - 48); color_left.Add(colorleft[i] - 48); color_right.Add(colorright[i] - 48); color_top.Add(colortop[i] - 48); color_bottom.Add(colorbottom[i] - 48); color_back.Add(colorback[i] - 48); //Debug.Log(color[i] - 48); } PieceFactory pf = Singleton <PieceFactory> .Instance; pf.LoadSrc(size, colorlist, color_left, color_right, color_bottom, color_back, color_top); }