void OnResponse(object sender, UseItemCmpt.EventArg e) { if (item.type != OBJECT.OBJECTTYPE.ItemProto) { return; } if (item.isSpecificPrototype) { if (item.Id == e.itemObj.protoId) { Post(); } } else if (item.isAnyPrototypeInCategory) { if (ItemAsset.ItemProto.Mgr.Instance == null) { return; } ItemAsset.ItemProto proto = ItemAsset.ItemProto.Mgr.Instance.Get(e.itemObj.protoId); if (proto == null) { return; } if (item.Group == proto.editorTypeId) { Post(); } } else if (item.isAnyPrototype && e.itemObj != null) { Post(); } }
void OnNetResponse(ItemAsset.ItemObject itemObj) { if (item.type != OBJECT.OBJECTTYPE.ItemProto) { return; } if (item.isSpecificPrototype) { if (item.Id == itemObj.protoId) { Post(); } } else if (item.isAnyPrototypeInCategory) { if (ItemAsset.ItemProto.Mgr.Instance == null) { return; } ItemAsset.ItemProto proto = ItemAsset.ItemProto.Mgr.Instance.Get(itemObj.protoId); if (proto == null) { return; } if (item.Group == proto.editorTypeId) { Post(); } } else if (item.isAnyPrototype && itemObj != null) { Post(); } }
public float GetCdByItemProto(ItemAsset.ItemProto proto) { if (proto == null) { return(0f); } return(GetCd(proto.skillId)); }
// 执行动作 // 若为瞬间动作,返回true; // 若为持续动作,该函数会每帧被调用,直到返回true public override bool Logic() { if (Pathea.PeGameMgr.IsMulti) { byte[] data = PETools.Serialize.Export(w => { BufferHelper.Serialize(w, player); BufferHelper.Serialize(w, item); w.Write(count); w.Write((byte)func); }); PlayerNetwork.RequestServer(EPacketType.PT_Custom_ModifyPackage, data); } else { if (player.type == OBJECT.OBJECTTYPE.Player && item.type == OBJECT.OBJECTTYPE.ItemProto && item.isSpecificPrototype) { Pathea.PeEntity entity = PeScenarioUtility.GetEntity(player); if (entity != null && entity.packageCmpt != null) { int num = entity.packageCmpt.GetItemCount(item.Id); int result = Utility.Function(num, count, func); if (result > 0) { entity.packageCmpt.Set(item.Id, result); } else { entity.packageCmpt.Destory(item.Id, num); if (result < 0) { Debug.LogWarning(string.Format("Items whose protoID is {0} are not enough.", item.Id)); } } if (result - num > 0) { ItemAsset.ItemProto proto = ItemAsset.ItemProto.Mgr.Instance.Get(item.Id); if (proto == null) { return(true); } string msg = proto.GetName() + " X " + (result - num).ToString(); new PeTipMsg(msg, proto.icon[0], PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Misc); } } } } return(true); }
void OnResponse(object sender, DraggingMgr.EventArg e) { if (item.type != OBJECT.OBJECTTYPE.ItemProto) { return; } ItemObjDragging items = e.dragable as ItemObjDragging; Pathea.PlayerPackageCmpt pkg = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PlayerPackageCmpt>(); if (pkg == null) { return; } if (item.isAnyPrototype) { Post(); } else if (item.isAnyPrototypeInCategory) { if (ItemAsset.ItemProto.Mgr.Instance == null) { return; } ItemAsset.ItemProto proto = ItemAsset.ItemProto.Mgr.Instance.Get(items.GetItemProtoId()); if (proto == null) { return; } if (item.Group == proto.editorTypeId) { Post(); } } else if (item.isSpecificPrototype) { if (item.Id == items.GetItemProtoId()) { Post(); } } }
public static bool IsObjectContainEntity(OBJECT obj, int scenarioId) // negative = player { if (obj.type == OBJECT.OBJECTTYPE.AnyObject) { return(true); } if (scenarioId > 0) { if (obj.isSpecificEntity) { if (CustomGameData.Mgr.Instance != null) { return((obj.Id == scenarioId) && (CustomGameData.Mgr.Instance.curGameData.WorldIndex == obj.Group)); } } else if (obj.type == OBJECT.OBJECTTYPE.MonsterProto) { SpawnPoint sp = PeCustomScene.Self.spawnData.GetMonster(scenarioId); if (sp != null) { if (obj.isSpecificPrototype) { if (obj.Id == sp.Prototype) { return(true); } } else if (obj.isAnyPrototypeInCategory) { Pathea.MonsterProtoDb.Item mpd = Pathea.MonsterProtoDb.Get(sp.Prototype); if (mpd != null && System.Array.FindIndex <int>(mpd.monsterAreaId, ite => ite == obj.Group) != -1) { return(true); } } } MonsterSpawnArea spa = PeCustomScene.Self.spawnData.GetMonsterArea(scenarioId); if (spa != null) { if (obj.isSpecificPrototype) { if (obj.Id == spa.Prototype) { return(true); } } else if (obj.isAnyPrototypeInCategory) { Pathea.MonsterProtoDb.Item mpd = Pathea.MonsterProtoDb.Get(spa.Prototype); if (mpd != null && System.Array.FindIndex <int>(mpd.monsterAreaId, ite => ite == obj.Group) != -1) { return(true); } } } } else if (obj.type == OBJECT.OBJECTTYPE.ItemProto) { SpawnPoint sp = PeCustomScene.Self.spawnData.GetItem(scenarioId); if (sp != null) { if (obj.isSpecificPrototype) { if (obj.Id == sp.Prototype) { return(true); } } else if (obj.isAnyPrototypeInCategory) { ItemAsset.ItemProto item = ItemAsset.ItemProto.GetItemData(sp.Prototype); return(item.editorTypeId == obj.Group); } } } else if (obj.isAnyNpo || obj.isAnyNpoInSpecificWorld) { SpawnPoint sp = PeCustomScene.Self.spawnData.GetSpawnPoint(scenarioId); if (sp == null) { return(false); } return(true); } } else { int current_player_id = PeCustomScene.Self.scenario.playerId; return(PlayerCheck(current_player_id, -scenarioId, obj)); } return(false); }
public float GetCdByItemProtoId(int itemProtoId) { ItemAsset.ItemProto proto = ItemAsset.ItemProto.Mgr.Instance.Get(itemProtoId); return(GetCdByItemProto(proto)); }