示例#1
0
 // Token: 0x06000683 RID: 1667 RVA: 0x0006BCEC File Offset: 0x00069EEC
 private void SpawnEels()
 {
     if (BTDebugCamInputManager.GetConfigHolder().hackConfig != null && BTDebugCamInputManager.GetConfigHolder().hackConfig.eelRoast_spawnAllEels)
     {
         foreach (EelRoastMarkerInfo markerInfo in this._EelRoastInfos)
         {
             string randomEelPath = this.GetRandomEelPath(markerInfo);
             if (!string.IsNullOrEmpty(randomEelPath))
             {
                 string[] array = randomEelPath.Split(new char[]
                 {
                     '/'
                 });
                 RsResourceManager.LoadAssetFromBundle(array[0] + "/" + array[1], array[2], new RsResourceEventHandler(this.ResourceEventHandler), typeof(GameObject), false, markerInfo);
             }
             else
             {
                 UtDebug.Log("Eel Asset path is empty ");
             }
         }
     }
     else
     {
         if (this._EelRoastInfos == null || this._EelRoastInfos.Length < 1 || this._NoOfEelsToSpawn.Min < 1f || this._NoOfEelsToSpawn.Min > this._NoOfEelsToSpawn.Max)
         {
             return;
         }
         List <EelRoastMarkerInfo> list = new List <EelRoastMarkerInfo>(this._EelRoastInfos);
         int num = Mathf.Clamp(this._NoOfEelsToSpawn.GetRandomInt(), 1, this._EelRoastInfos.Length);
         for (int i = 0; i < num; i++)
         {
             int    index         = UnityEngine.Random.Range(0, list.Count);
             string randomEelPath = this.GetRandomEelPath(list[index]);
             if (!string.IsNullOrEmpty(randomEelPath))
             {
                 string[] array = randomEelPath.Split(new char[]
                 {
                     '/'
                 });
                 RsResourceManager.LoadAssetFromBundle(array[0] + "/" + array[1], array[2], new RsResourceEventHandler(this.ResourceEventHandler), typeof(GameObject), false, list[index]);
             }
             else
             {
                 UtDebug.Log("Eel Asset path is empty ");
             }
             list.RemoveAt(index);
         }
     }
 }
示例#2
0
    // Token: 0x06000686 RID: 1670 RVA: 0x0006BEF0 File Offset: 0x0006A0F0
    private void SetUpEel(GameObject eelObject, string inURL, Transform spawnNode)
    {
        if (eelObject == null || spawnNode == null)
        {
            UtDebug.Log("Eel object or SpawnNode is null");
            return;
        }
        GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(eelObject, spawnNode.position, spawnNode.rotation);

        string[] array = inURL.Split(new char[]
        {
            '/'
        });
        gameObject.name = array[2];
    }
示例#3
0
    // Token: 0x06000684 RID: 1668 RVA: 0x0006BDF8 File Offset: 0x00069FF8
    private void ResourceEventHandler(string inURL, RsResourceLoadEvent inEvent, float inProgress, object inObject, object inUserData)
    {
        if (inEvent != RsResourceLoadEvent.COMPLETE)
        {
            if (inEvent == RsResourceLoadEvent.ERROR)
            {
                UtDebug.LogError("ERROR: CHEST MANAGER UNABLE TO LOAD RESOURCE AT: " + inURL);
            }
            return;
        }
        if (inObject == null || inUserData == null)
        {
            UtDebug.LogError("ERROR: Eel's inObject or inUserData is null");
            return;
        }
        EelRoastMarkerInfo eelRoastMarkerInfo = inUserData as EelRoastMarkerInfo;

        this.SetUpEel((GameObject)inObject, inURL, eelRoastMarkerInfo._SpawnNode);
    }
示例#4
0
    //e.g)
    //{
    //    "filename": "texture_00.png",
    //    "frame": {"x":2,"y":2,"w":1016,"h":1004},
    //    "spriteSourceSize": {"x":3,"y":13,"w":1016,"h":1004},
    //    "sourceSize": {"w":1024,"h":1024}
    //}
    public static TextureLayout loadJson(Value json)
    {
        var ret = new TextureLayout();

        try
        {
            ret.filename  = json.get("filename").toString();
            ret.srcWidth  = json.get("sourceSize").get("w").toInt(0);
            ret.srcHeight = json.get("sourceSize").get("h").toInt(0);

            ret.x     = json.get("frame").get("x").toInt(0);
            ret.y     = json.get("frame").get("y").toInt(0);
            ret.trimX = json.get("spriteSourceSize").get("x").toInt(0);
            ret.trimY = json.get("spriteSourceSize").get("y").toInt(0);
        }
        catch (Exception)
        {
            UtDebug.print("JSON Parse Error!");
        }

        return(ret);
    }
示例#5
0
    //e.g)
    //{"frames": [
    //{
    //    "filename": "texture_00.png",
    //    "frame": {"x":2,"y":2,"w":1016,"h":1004},
    //    "spriteSourceSize": {"x":3,"y":13,"w":1016,"h":1004},
    //    "sourceSize": {"w":1024,"h":1024}
    //},
    //{
    //    "filename": "texture_01.png",
    //    "frame": {"x":1020,"y":2,"w":972,"h":1011},
    //    "spriteSourceSize": {"x":29,"y":4,"w":972,"h":1011},
    //    "sourceSize": {"w":1024,"h":1024}
    //}],
    //"meta": {
    //    "image": "texture_atlas.png",
    //    "size": {"w":2048,"h":2048}
    //}
    //}
    public static TextureAtlasLayout loadJson(Value json)
    {
        var ret = new TextureAtlasLayout();

        try
        {
            ret.image  = json.get("meta").get("image").toString();
            ret.width  = json.get("meta").get("size").get("w").toInt(0);
            ret.height = json.get("meta").get("size").get("h").toInt(0);

            var array = json.get("frames").getVector(null);
            int n     = array.Count;
            for (int i = 0; i < n; i++)
            {
                ret.frames.Add(TextureLayout.loadJson(array[i]));
            }
        }
        catch (Exception)
        {
            UtDebug.print("JSON Parse Error!");
        }

        return(ret);
    }
示例#6
0
        public static L2DPhysics load(char[] buf)
        {
            L2DPhysics ret = new L2DPhysics();

            Value json = Json.parseFromBytes(buf);


            List <Value> params_  = json.get("physics_hair").getVector(null);
            int          paramNum = params_.Count;

            for (int i = 0; i < paramNum; i++)
            {
                Value param = params_[i];

                PhysicsHair physics = new PhysicsHair();

                Value setup = param.get("setup");

                float length = setup.get("length").toFloat();

                float resist = setup.get("regist").toFloat();

                float mass = setup.get("mass").toFloat();
                physics.setup(length, resist, mass);


                List <Value> srcList = param.get("src").getVector(null);
                int          srcNum  = srcList.Count;
                for (int j = 0; j < srcNum; j++)
                {
                    Value           src     = srcList[j];
                    string          id      = src.get("id").toString();//param ID
                    PhysicsHair.Src type    = PhysicsHair.Src.SRC_TO_X;
                    string          typeStr = src.get("ptype").toString();
                    if (typeStr == "x")
                    {
                        type = PhysicsHair.Src.SRC_TO_X;
                    }
                    else if (typeStr == "y")
                    {
                        type = PhysicsHair.Src.SRC_TO_Y;
                    }
                    else if (typeStr == "angle")
                    {
                        type = PhysicsHair.Src.SRC_TO_G_ANGLE;
                    }
                    else
                    {
                        UtDebug.error("live2d", "Invalid parameter:hysicsHair.Src");
                    }

                    float scale  = src.get("scale").toFloat();
                    float weight = src.get("weight").toFloat();
                    physics.addSrcParam(type, id, scale, weight);
                }


                List <Value> targetList = param.get("targets").getVector(null);
                int          targetNum  = targetList.Count;
                for (int j = 0; j < targetNum; j++)
                {
                    Value              target  = targetList[j];
                    string             id      = target.get("id").toString();//param ID
                    PhysicsHair.Target type    = PhysicsHair.Target.TARGET_FROM_ANGLE;
                    string             typeStr = target.get("ptype").toString();
                    if (typeStr == "angle")
                    {
                        type = PhysicsHair.Target.TARGET_FROM_ANGLE;
                    }
                    else if (typeStr == "angle_v")
                    {
                        type = PhysicsHair.Target.TARGET_FROM_ANGLE_V;
                    }
                    else
                    {
                        UtDebug.error("live2d", "Invalid parameter:PhysicsHair.Target");
                    }

                    float scale  = target.get("scale").toFloat();
                    float weight = target.get("weight").toFloat();
                    physics.addTargetParam(type, id, scale, weight);
                }
                ret.addParam(physics);
            }

            return(ret);
        }