Exemple #1
0
 /// <summary>
 /// 根据网络数据设置实体属性值。
 /// </summary>
 /// <param name="args"></param>
 public void SetEntityInfo(BaseAttachedInfo info)
 {
     ID     = info.id;
     dbid   = info.dbid;
     entity = info.entity;
     SynEntityAttrs(info);
 }
        public override void Login(string _passport, string _password, string _loginArgs)
        {
            var baseInfo = new BaseAttachedInfo();

            baseInfo.typeId = 1;                                  //entity type id
            baseInfo.id     = (uint)Guid.NewGuid().GetHashCode();
            baseInfo.dbid   = (uint)Guid.NewGuid().GetHashCode(); //dbid
            baseInfo.entity = DefParser.Instance.GetEntityByName("Account");
            baseInfo.props  = new List <KeyValuePair <EntityDefProperties, object> >();

            EventDispatcher.TriggerEvent <BaseAttachedInfo>(Events.FrameWorkEvent.EntityAttached, baseInfo);
        }
Exemple #3
0
    // 协议处理函数
    static private void OnEntityAttached(BaseAttachedInfo baseInfo)
    {
        if (baseInfo.entity == null)
        {
            LoggerHelper.Error("Entity Attach Error.");
            return;
        }
        switch (baseInfo.entity.Name)
        {
        case "Avatar":
        {
            if (MogoWorld.thePlayer == null)
            {
                thePlayer = new EntityMyself();
            }
            //UnityLog.Sys("MySelfAttribute: "+ObjectDumper.Dump(baseInfo));
            thePlayer.SetEntityInfo(baseInfo);
            thePlayer.entity = baseInfo.entity;
            if (IsSingleMatch)
            {
                StartSingleMatch();
            }
            else
            {
                StartMatch();
            }
            TimerHeap.AddTimer(1000, 1000, () =>
                {
                    MogoWorld.thePlayer.RpcCall("HeartBeat");
                });
            break;
        }

        default:
            break;
        }
    }