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);
    }
 public void UpdateUninitPlayerInfo(S2c_aoi_syncplayer playerInfo)
 {
     if (this.entityCreate._heroInfo != null && this.entityCreate._heroInfo.sync.rid == playerInfo.rid)
     {
         this.entityCreate._heroInfo.sync = playerInfo;
         return;
     }
     for (int i = 0; i < this.entityCreate._players.Count; i++)
     {
         if (this.entityCreate._players[i].sync.rid == playerInfo.rid)
         {
             this.entityCreate._players[i].sync = playerInfo;
             break;
         }
     }
 }
Beispiel #3
0
    private static int get_sync(IntPtr L)
    {
        object obj = null;
        int    result;

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

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_addself    s2c_aoi_addself = (S2c_aoi_addself)obj;
            S2c_aoi_syncplayer sync            = (S2c_aoi_syncplayer)ToLua.CheckObject(L, 2, typeof(S2c_aoi_syncplayer));
            s2c_aoi_addself.sync = sync;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index sync on a nil value");
        }
        return(result);
    }
Beispiel #5
0
    private static int set_rid(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncplayer s2c_aoi_syncplayer = (S2c_aoi_syncplayer)obj;
            string             rid = ToLua.CheckString(L, 2);
            s2c_aoi_syncplayer.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 #6
0
    private static int set_shape(IntPtr L)
    {
        object obj = null;
        int    result;

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

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncplayer s2c_aoi_syncplayer = (S2c_aoi_syncplayer)obj;
            LuaTable           buff = ToLua.CheckLuaTable(L, 2);
            s2c_aoi_syncplayer.buff = buff;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index buff on a nil value");
        }
        return(result);
    }
Beispiel #8
0
    private static int get_speed(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncplayer s2c_aoi_syncplayer = (S2c_aoi_syncplayer)obj;
            float speed = s2c_aoi_syncplayer.speed;
            LuaDLL.lua_pushnumber(L, (double)speed);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index speed on a nil value");
        }
        return(result);
    }
Beispiel #9
0
    private static int get_clubpost(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncplayer s2c_aoi_syncplayer = (S2c_aoi_syncplayer)obj;
            string             clubpost           = s2c_aoi_syncplayer.clubpost;
            LuaDLL.lua_pushstring(L, clubpost);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index clubpost on a nil value");
        }
        return(result);
    }
Beispiel #10
0
    private static int get_isyunbiao(IntPtr L)
    {
        object obj = null;
        int    result;

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

        try
        {
            obj = ToLua.ToObject(L, 1);
            S2c_aoi_syncplayer s2c_aoi_syncplayer = (S2c_aoi_syncplayer)obj;
            int jingmai_model = s2c_aoi_syncplayer.jingmai_model;
            LuaDLL.lua_pushinteger(L, jingmai_model);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index jingmai_model 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 #13
0
    private static int _CreateAoi_S2c_aoi_syncplayer(IntPtr L)
    {
        int result;

        try
        {
            if (LuaDLL.lua_gettop(L) == 0)
            {
                S2c_aoi_syncplayer o = new S2c_aoi_syncplayer();
                ToLua.PushObject(L, o);
                result = 1;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to ctor method: Aoi.S2c_aoi_syncplayer.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;
        }
    }