Ejemplo n.º 1
0
    public EffectData(int id, ulong guid, GTTransform data, Transform parent, bool retain)
    {
        this.ID     = id;
        this.GUID   = guid > 0 ? guid : GTGUID.NewGUID();
        this.Parent = parent;
        this.Retain = retain;
        this.Cfg    = ReadCfgEffect.GetDataById(id);
        if (Cfg == null)
        {
            Debug.LogError("不存在特效ID =" + ID);
            return;
        }
        GameObject go = GTPoolManager.Instance.GetObject(Cfg.Path);

        if (go == null)
        {
            go = new GameObject(ID.ToString());
        }
        this.CacheTransform = go.transform;
        NGUITools.SetLayer(go, GTLayer.LAYER_EFFECT);
        this.CacheTransform.parent           = this.Parent != null ? Parent : null;
        this.CacheTransform.localScale       = Vector3.one;
        this.CacheTransform.localEulerAngles = data.Euler;
        this.CacheTransform.localPosition    = data.Pos;
        this.TriggerObject = go.GET <ETriggerObject>();
    }
Ejemplo n.º 2
0
 public void EnterWorld(MapConfig data)
 {
     for (int i = 0; i < data.MapNpcs.Count; i++)
     {
         MapNpc cfg = data.MapNpcs[i];
         DActor db  = ReadCfgActor.GetDataById(cfg.NpcID);
         if (db == null)
         {
             continue;
         }
         XCharacter c = new XCharacter();
         c.Id   = cfg.NpcID;
         c.Name = db.Name;
         c.GUID = GTGUID.NewGUID();
         c.PosX = cfg.Pos.x;
         c.PosY = cfg.Pos.y;
         c.PosZ = cfg.Pos.z;
         c.Face = cfg.Face;
         c.Type = (int)EActorType.NPC;
         c.Camp = (int)EBattleCamp.CT_PVE_NEUTRAL;
         c.CurAttrs.AddRange(GTTools.GetListFromEnumNames <int>(typeof(EAttr)));
         foreach (var current in db.Attrs)
         {
             c.CurAttrs[(int)current.Key - 1] = current.Value;
         }
         m_AllActors.Add(c.GUID, c);
     }
     for (int i = 0; i < data.MapAreaMonsters.Count; i++)
     {
         MapAreaMonster cfg = data.MapAreaMonsters[i];
         DActor         db  = ReadCfgActor.GetDataById(cfg.MonsterID);
         if (db == null)
         {
             continue;
         }
         for (int k = 0; k < cfg.Points.Count; k++)
         {
             MapPoint   p = cfg.Points[k];
             XCharacter c = new XCharacter();
             c.Id   = cfg.MonsterID;
             c.Name = db.Name;
             c.GUID = GTGUID.NewGUID();
             c.PosX = p.Pos.x;
             c.PosY = p.Pos.y;
             c.PosZ = p.Pos.z;
             c.Face = p.EulerAngles.y;
             c.Type = (int)EActorType.MONSTER;
             c.Camp = (int)EBattleCamp.CT_PVE_ENEMY;
             c.CurAttrs.AddRange(GTTools.GetListFromEnumNames <int>(typeof(EAttr)));
             foreach (var current in db.Attrs)
             {
                 c.CurAttrs[(int)current.Key - 1] = current.Value;
             }
             m_AllActors.Add(c.GUID, c);
         }
     }
 }
Ejemplo n.º 3
0
    public static XCharacter CreatePlayer(int id, string name)
    {
        XCharacter tab = new XCharacter();

        tab.Name  = name;
        tab.Id    = id;
        tab.Level = 1;
        tab.GUID  = GTGUID.NewGUID();
        return(tab);
    }
Ejemplo n.º 4
0
    public Character AddActor(int id, EBattleCamp camp, EActorType type, GTTransform bornData, XCharacter data, bool isMain = false)
    {
        Character cc = new Character(id, data == null ? GTGUID.NewGUID() : data.GUID, type, camp, isMain);

        bornData.Pos = GTTools.NavSamplePosition(bornData.Pos);
        cc.Load(bornData);
        cc.SyncData(data, ESyncDataType.TYPE_ALL);
        SetCharacterParent(cc);
        Characters.Add(cc);
        return(cc);
    }
Ejemplo n.º 5
0
    private void OnReq_CreateRole(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        RoleCreateReq          req = Serializer.Deserialize <RoleCreateReq>(ms);

        RoleCreateAck ack = new RoleCreateAck();

        ack.RoleID    = GTGUID.NewGUID();
        ack.Name      = req.Name;
        ack.RoleType  = req.RoleType;
        ack.AccountID = req.AccountID;
        NetworkManager.Instance.Send(MessageID.MSG_ROLE_CREATE_ACK, ack, 0, 0);
    }