public GameObject InitilizeSelfEntity(Aoi_add_normalmsg nmsg, S2c_aoi_syncplayer sync, string name)
    {
        GameObject  gameObject = this._loadEntityRes(RoleManager.EntityType.EntityType_Self, nmsg.char_no.ToString());
        SceneEntity component  = gameObject.GetComponent <SceneEntity>();

        if (component == null)
        {
            Debug.LogError("Initilize entity error! Type: " + RoleManager.EntityType.EntityType_Self);
            return(null);
        }
        object[] array = Util.CallMethod("PLAYERLOADER", "LoadMainRole", new object[]
        {
            component
        });
        component.SetKeyValue("clubname", sync.clubname);
        component.SetKeyValue("clubpost", sync.clubpost);
        if (array == null || array.Length == 0)
        {
            Debug.LogError("获取主角模型资源路径错误");
            return(null);
        }
        GameObject gameObject2 = (GameObject)array[0];

        if (gameObject2 == null)
        {
            Debug.LogError(string.Concat(new object[]
            {
                "加载角色模型错误![id]",
                nmsg.char_no,
                " [type]",
                RoleManager.EntityType.EntityType_Self
            }));
        }
        Vector3 pos = Util.Convert2RealPosition(nmsg.x, nmsg.y, nmsg.z);

        this.SetEntityInfo(gameObject, gameObject2, pos, sync.dir360, sync.speed, component, name, sync.grade, string.Empty, sync.comp, nmsg.hpmax, nmsg.hp, false, RoleManager.EntityType.EntityType_Self, sync.pkinfo);
        Util.CallMethod("PLAYERLOADER", "LoadOtherShape", new object[]
        {
            component,
            1,
            component.weapon,
            sync.shenyi_model
        });
        if (sync.up_mount == 1)
        {
            component.isRide = true;
        }
        if (component.weapon_model != null)
        {
            component.ChangeShader(component.weapon_model);
        }
        if (component.shenyi_model != null)
        {
            component.ChangeShader(component.shenyi_model);
        }
        return(gameObject);
    }
Beispiel #2
0
    private static int set_nmsg(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_addplayer s2c_aoi_addplayer = (S2c_aoi_addplayer)obj;
            Aoi_add_normalmsg nmsg = (Aoi_add_normalmsg)ToLua.CheckObject(L, 2, typeof(Aoi_add_normalmsg));
            s2c_aoi_addplayer.nmsg = nmsg;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index nmsg on a nil value");
        }
        return(result);
    }
Beispiel #3
0
    private static int get_nmsg(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_addself   s2c_aoi_addself = (S2c_aoi_addself)obj;
            Aoi_add_normalmsg nmsg            = s2c_aoi_addself.nmsg;
            ToLua.PushObject(L, nmsg);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index nmsg on a nil value");
        }
        return(result);
    }
Beispiel #4
0
    private static int get_hpmax(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            Aoi_add_normalmsg aoi_add_normalmsg = (Aoi_add_normalmsg)obj;
            int hpmax = aoi_add_normalmsg.hpmax;
            LuaDLL.lua_pushinteger(L, hpmax);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index hpmax on a nil value");
        }
        return(result);
    }
Beispiel #5
0
    private static int set_z(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            Aoi_add_normalmsg aoi_add_normalmsg = (Aoi_add_normalmsg)obj;
            int z = (int)LuaDLL.luaL_checknumber(L, 2);
            aoi_add_normalmsg.z = z;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index z on a nil value");
        }
        return(result);
    }
Beispiel #6
0
    private static int set_rid(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            Aoi_add_normalmsg aoi_add_normalmsg = (Aoi_add_normalmsg)obj;
            string            rid = ToLua.CheckString(L, 2);
            aoi_add_normalmsg.rid = rid;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index rid on a nil value");
        }
        return(result);
    }
Beispiel #7
0
    private static int get_y(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            Aoi_add_normalmsg aoi_add_normalmsg = (Aoi_add_normalmsg)obj;
            float             y = aoi_add_normalmsg.y;
            LuaDLL.lua_pushnumber(L, (double)y);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index y on a nil value");
        }
        return(result);
    }
    private static int InitilizeSelfEntity(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 4);
            EntityCreate       entityCreate = (EntityCreate)ToLua.CheckObject(L, 1, typeof(EntityCreate));
            Aoi_add_normalmsg  nmsg         = (Aoi_add_normalmsg)ToLua.CheckObject(L, 2, typeof(Aoi_add_normalmsg));
            S2c_aoi_syncplayer sync         = (S2c_aoi_syncplayer)ToLua.CheckObject(L, 3, typeof(S2c_aoi_syncplayer));
            string             name         = ToLua.CheckString(L, 4);
            GameObject         obj          = entityCreate.InitilizeSelfEntity(nmsg, sync, name);
            ToLua.Push(L, obj);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Beispiel #9
0
    private static int _CreateAoi_Aoi_add_normalmsg(IntPtr L)
    {
        int result;

        try
        {
            if (LuaDLL.lua_gettop(L) == 0)
            {
                Aoi_add_normalmsg o = new Aoi_add_normalmsg();
                ToLua.PushObject(L, o);
                result = 1;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to ctor method: Aoi.Aoi_add_normalmsg.New");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
    private void AsyncInitilizeEntity(Aoi_add_normalmsg nmsg, S2c_aoi_syncplayer syncPlayer, S2c_aoi_syncnpc syncNpc, string name, string ownerId, RoleManager.EntityType entityType, Action <GameObject> callback = null)
    {
        GameObject  go  = this._loadEntityRes(entityType, nmsg.rid);
        SceneEntity obj = null;

        if (go)
        {
            obj = go.GetComponent <SceneEntity>();
            Util.CallMethod("PLAYERLOADER", "SetXlsInfo", new object[]
            {
                obj,
                (int)entityType,
                nmsg.char_no,
                (syncPlayer == null) ? 0 : syncPlayer.isyunbiao
            });
            if (syncPlayer != null)
            {
                obj.SetData(nmsg.rid, nmsg.char_no, syncPlayer.sex, syncPlayer.speed, syncPlayer.weapon, syncPlayer.mount_model, syncPlayer.partnerhorse_model, syncPlayer.lingqin_model, syncPlayer.lingyi_model, syncPlayer.pet_model, syncPlayer.shenjian_model, syncPlayer.shenyi_model, syncPlayer.jingmai_model, syncPlayer.score, syncPlayer.up_mount, syncPlayer.up_horse, syncPlayer.fashion, syncPlayer.dazuo, 0, 0, syncPlayer.isyunbiao);
                obj.SetKeyValue("clubname", syncPlayer.clubname);
                obj.SetKeyValue("clubpost", syncPlayer.clubpost);
            }
            else
            {
                obj.SetData(nmsg.rid, nmsg.char_no, 0, 0f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, syncNpc.shield_hp, syncNpc.shield_hpmax, 0);
            }
            int shape = (syncPlayer == null) ? syncNpc.shape : syncPlayer.shape;
            if (syncPlayer != null && syncPlayer.fashion > 0)
            {
                shape = syncPlayer.fashion;
            }
            int    grade     = (syncPlayer == null) ? syncNpc.grade : syncPlayer.grade;
            int    comp      = (syncPlayer == null) ? syncNpc.comp : syncPlayer.comp;
            bool   canAttack = syncPlayer != null || syncNpc.canattk == 1;
            string pkMode    = (syncPlayer == null) ? string.Empty : syncPlayer.pkinfo;
            this.AsyncLoadCharacter(go.transform, shape, entityType, obj, delegate(GameObject model, string prefabPath)
            {
                if (model == null)
                {
                    model        = Util.LoadBucket(go.transform);
                    obj.isBucket = true;
                }
                model.transform.localScale = Vector3.one;
                Vector3 pos = Util.Convert2RealPosition(nmsg.x, nmsg.y, nmsg.z);
                this.SetEntityInfo(go, model, pos, (syncPlayer == null) ? syncNpc.dir : syncPlayer.dir360, (syncPlayer == null) ? 0f : syncPlayer.speed, obj, name, grade, ownerId, comp, nmsg.hpmax, nmsg.hp, canAttack, entityType, pkMode);
                if (callback != null)
                {
                    callback(go);
                }
                if (syncPlayer != null)
                {
                    Util.CallMethod("PLAYERLOADER", "LoadOtherShape", new object[]
                    {
                        obj,
                        (int)entityType,
                        syncPlayer.shenjian_model,
                        syncPlayer.shenyi_model
                    });
                    if (obj.up_mount == 1)
                    {
                        obj.isRide = true;
                    }
                }
            });
            return;
        }
    }