public override bool Parse() { if (false == base.Parse()) { return(false); } mPlayerId = PeType.GetPlayerId(mInfo, mTrigger); return(true); }
public override bool Parse() { mPlayerId = PeType.GetPlayerId(mInfo, mTrigger); mItemId = PeType.GetItemId(mInfo, mTrigger); mItemCount = PatheaScript.Util.GetVarRefOrValue(mInfo, "count", VarValue.EType.Int, mTrigger); mCompare = mFactory.GetCompare(mInfo, "compare"); return(true); }
protected override bool Exec() { VarRef playerId = PeType.GetPlayerId(mInfo, mTrigger); VarRef itemIdVarRef = PeType.GetItemId(mInfo, mTrigger); VarRef count = PatheaScript.Util.GetVarRefOrValue(mInfo, "count", VarValue.EType.Int, mTrigger); Functor modify = mFactory.GetFunctor(mInfo, "modify"); List <Pathea.PeEntity> playerList = PeType.GetPlayer((int)playerId.Value); int itemId = (int)itemIdVarRef.Value; foreach (Pathea.PeEntity player in playerList) { Pathea.PlayerPackageCmpt pkg = player.GetCmpt <Pathea.PlayerPackageCmpt>(); ItemAsset.ItemPackage accessor = pkg.package._playerPak; int itemCount = accessor.GetCount(itemId); modify.Set(new Variable(itemCount), count.Var); modify.Do(); int newItemCount = (int)(modify.Target.Value); if (newItemCount == itemCount) { continue; } else if (newItemCount > itemCount) { int dd = newItemCount - itemCount; if (!accessor.Add(itemId, dd)) { Debug.LogError("Add item:" + itemId + " to player:" + player + " failed."); } else { Debug.Log("Add item:" + itemId + " count:" + dd + " to player:" + player + " succeed."); } } else { int dd = itemCount - newItemCount; accessor.Destroy(itemId, dd); Debug.Log("remove item:" + itemId + " count:" + dd + "from player:" + player + " succeed."); } } return(true); }
protected override bool Exec() { VarRef playerId = PeType.GetPlayerId(mInfo, mTrigger); VarRef varRef = PatheaScript.Util.GetVarRefOrValue(mInfo, "pos", VarValue.EType.Vector3, mTrigger); //TODO:need parse func List <Pathea.PeEntity> playerList = PeType.GetPlayer((int)playerId.Value); foreach (Pathea.PeEntity player in playerList) { Pathea.PeTrans v = player.GetCmpt <Pathea.PeTrans>(); v.position = (Vector3)varRef.Value; } return(true); }