/// <summary> /// �����е�����������ϵ�����ʹ�ã��ͻ�����ʵ��������ɷ��� /// </summary> void CreatTower() { if (mHasCreated) { return; } if (mItemSample == null) { return; } ItemObject obj = mItemSample as ItemObject; ItemAsset.Drag drag = null; if (null != obj) { drag = obj.GetCmpt <ItemAsset.Drag>(); } // if (mItemPlace == null) // unreachable code ! // return; if (obj != null && drag != null && (mItemPlace == ItemPlaceType.IPT_Bag || mItemPlace == ItemPlaceType.IPT_HotKeyBar) && !GameUI.Instance.bMainPlayerIsDead ) { ItemObjDragging dragging = new ItemObjDragging(drag); DraggingMgr.Instance.Begin(dragging); } else { //mCurrenReq = null; } mHasCreated = true; }
public DragItemAgent(ItemAsset.Drag drag, Vector3 pos, Vector3 scl, Quaternion rot, int id, NetworkInterface net = null) { mId = id; _pos = pos; _sca = scl; _rot = rot; network = net; itemDrag = drag; }
void RPC_Tower_InitData(uLink.BitStream stream, uLink.NetworkMessageInfo info) { _pos = transform.position = stream.Read <Vector3>(); rot = transform.rotation = stream.Read <Quaternion>(); ItemObject itemObj = stream.Read <ItemObject>(); if (null == itemObj) { LogManager.Error("Invalid tower item"); return; } //[zhujiangbo] // int itemProtoId = itemObj.protoId; ItemAsset.Drag drag = itemObj.GetCmpt <ItemAsset.Drag>(); if (null == drag) { return; } DragTowerAgent item = new DragTowerAgent(drag, transform.position, Vector3.one, transform.rotation, Id, this); item.Create(); SceneMan.AddSceneObj(item); _entity = EntityMgr.Instance.Get(Id); if (null == _entity) { return; } Pathea.TowerProtoDb.Item tower = Pathea.TowerProtoDb.Get(itemObj.protoData.towerEntityId); if (null != tower) { gameObject.name = tower.name + "_" + Id; } OnSpawned(_entity.GetGameObject()); //OnSkAttrInitEvent += InitForceData; InitMapInfo(); }
protected virtual void Deserialize(System.IO.BinaryReader br) { int itemInstanceId = br.ReadInt32(); ItemAsset.ItemObject itemObj = ItemMgr.Instance.Get(itemInstanceId); if (null != itemObj) { itemDrag = itemObj.GetCmpt <ItemAsset.Drag>(); } else { Debug.LogError("[Error]Cant find item object by id:" + itemInstanceId); itemDrag = null; } mId = br.ReadInt32(); _pos = PETools.Serialize.ReadVector3(br); _sca = PETools.Serialize.ReadVector3(br); _rot = PETools.Serialize.ReadQuaternion(br); Create(); }
public DragItemAgent(ItemAsset.Drag drag, Vector3 pos) : this(drag, pos, Vector3.one, Quaternion.identity, SceneMan.InvalidID) { }
public DragItemAgent(ItemAsset.Drag drag, Vector3 pos, Quaternion rot) : this(drag, pos, Vector3.one, rot, SceneMan.InvalidID) { }