Ejemplo n.º 1
0
        public void ImportOldJSON(HashRequist _HashRequist, DehashRequist _DehashRequist)
        //F4
        {
            lvlData.objs      = new LvlObject[] {};
            lvlData.creatures = new CreatureU[] {};
            base.ImportOldJSON(_HashRequist, _DehashRequist);
            if (jsonText != "")
            {
//			_HashRequist(jsonText, delegate(Hashtable LvlOld1){
//				string file=(string)LvlOld1["file"];
//				jsonText=(string)LvlOld1["lvl"];
                _HashRequist(jsonText, delegate(Hashtable LvlOld){
                    Hashtable bots = (Hashtable)LvlOld["bots"];
                    int count      = 0;
                    //Заполним список AssetBundle
                    double _id     = (double)LvlOld["id"];
                    lvlData.id     = Convert.ToInt32(_id);
                    Hashtable objs = (Hashtable)LvlOld["objs"];
                    foreach (string key in objs.Keys)
                    {
                        if (PlayerPrefs.GetInt("debug") == 1)
                        {
                            Debug.Log("LvlCfg.ImportOldJSON key=" + key);
                        }
                        _DehashRequist((Hashtable)objs[key], delegate(string _str){
                            LvlObject lo = (LvlObject)JsonUtility.FromJson(_str, typeof(LvlObject));
                            System.Array.Resize(ref lvlData.objs, lvlData.objs.Length + 1);
                            lvlData.objs[lvlData.objs.Length - 1] = lo;
                        });
                    }

                    for (int i = 0; i < 10; i++)
                    {
                        CreatureU cu = new CreatureU();
                        if (bots["" + i] != null)
                        {
                            UnityScript.Lang.Array ba = (UnityScript.Lang.Array)bots["" + i];
                            cu.count = Convert.ToInt32(ba[0]);
                            cu.level = Convert.ToInt32(ba[1]);
                        }
                        else
                        {
                            cu.count = 0;
                            cu.level = 0;
                        }
                        System.Array.Resize(ref lvlData.creatures, lvlData.creatures.Length + 1);
                        lvlData.creatures[lvlData.creatures.Length - 1] = cu;
                    }
                    _DehashRequist((Hashtable)LvlOld["property"], delegate(string _str){
                        LvlObject lo     = (LvlObject)JsonUtility.FromJson(_str, typeof(LvlObject));
                        lvlData.property = (LvlProperty)JsonUtility.FromJson(_str, typeof(LvlProperty));
                    });
                });
//			});
            }
//		lvlData.objs=obja;
//		lvlData.creatures=creatures;
            jsonText = "";
        }
Ejemplo n.º 2
0
 private void SetFromUndo(byte[] terrainTypeData)
 {
     TerrainTypeData    = terrainTypeData;
     TerrainTypeData2D  = null;
     TerrainTypeTexture = null;
     //            TerrainTypeTexture.SetPixels(texData);
     //            TerrainTypeTexture.Apply();
     ScmapEditor.Current.TerrainMaterial.SetTexture("_TerrainTypeAlbedo", TerrainTypeTexture);
 }
Ejemplo n.º 3
0
 private UnityScript.Lang.Array ConcatImpl(ICollection value, IEnumerable items)
 {
     if (items == null)
     {
         throw new ArgumentNullException("items");
     }
     UnityScript.Lang.Array array = new UnityScript.Lang.Array(this.InnerList);
     array.InnerList.AddRange(value);
     IEnumerator enumerator = items.GetEnumerator();
     while (enumerator.MoveNext())
     {
         object current = enumerator.Current;
         if (!(current is ICollection))
         {
         }
         ICollection c = (ICollection) RuntimeServices.Coerce(current, typeof(ICollection));
         array.InnerList.AddRange(c);
     }
     return array;
 }
Ejemplo n.º 4
0
 public static void SetUndoData(byte[] terrainTypeData)
 {
     instance.SetFromUndo(terrainTypeData);
 }
Ejemplo n.º 5
0
 private UnityScript.Lang.Array ConcatImpl(ICollection value, IEnumerable items)
 {
     if (items == null)
     {
         throw new ArgumentNullException("items");
     }
     UnityScript.Lang.Array array = new UnityScript.Lang.Array(this.InnerList);
     array.InnerList.AddRange(value);
     IEnumerator enumerator = items.GetEnumerator();
     while (enumerator.MoveNext())
     {
         object current = enumerator.Current;
         if (!(current is ICollection))
         {
         }
         ICollection c = (ICollection) RuntimeServices.Coerce(current, typeof(ICollection));
         array.InnerList.AddRange(c);
     }
     return array;
 }