void RPC_S2C_CLN_PlantPutOut(uLink.BitStream stream, uLink.NetworkMessageInfo info) { Vector3 pos = stream.Read <Vector3>(); Quaternion rot = stream.Read <Quaternion>(); int objID = stream.Read <int>(); /*byte type = */ stream.Read <byte>(); //FarmPlantLogic mPlant = FarmManager.Instance.GetPlantByItemObjID (objID); //if(null == mPlant) //{ // mPlant = FarmManager.Instance.CreatePlant(objID, PlantInfo.GetPlantInfoByItemId(m_ItemID).mTypeID, pos); // mPlant.mTerrianType = type; // mPlant.UpdateGrowRate(0); //} //mPlant.mPos = pos; //DragArticleAgent item = DragArticleAgent.PutItemByProroId(objID, pos, transform.rotation); ItemObject itemobj = ItemMgr.Instance.Get(objID); DragArticleAgent dragItem = DragArticleAgent.Create(itemobj.GetCmpt <Drag>(), pos, Vector3.one, rot, objID); FarmPlantLogic plant = dragItem.itemLogic as FarmPlantLogic; plant.InitInMultiMode(); stream.Read <FarmPlantLogic>(); plant.UpdateInMultiMode(); }
void RPC_S2C_Plant_PutOut(uLink.BitStream stream, uLink.NetworkMessageInfo info) { Vector3 pos = stream.Read <Vector3>(); Quaternion rot = stream.Read <Quaternion>(); Vector3 scale = stream.Read <Vector3>(); int instanceId = stream.Read <int>(); ItemObject itemobj = ItemMgr.Instance.Get(instanceId); DragArticleAgent dragItem = DragArticleAgent.Create(itemobj.GetCmpt <Drag>(), pos, scale, rot, instanceId); FarmPlantLogic plant = dragItem.itemLogic as FarmPlantLogic; plant.InitInMultiMode(); stream.Read <FarmPlantLogic>(); plant.UpdateInMultiMode(); //DragItem item = new DragItem(objID); //item.position = plantPos; //item.rotation = transform.rotation; //item.itemScript = null; ////item.DependType = dependType; //item.network = this; //DragItem.Mgr.Instance.Add(item); }
private void RPC_S2C_Plant_UpdateInfo(uLink.BitStream stream, uLink.NetworkMessageInfo info) { FarmPlantLogic plant = stream.Read <FarmPlantLogic>(); if (plant != null) { plant.UpdateInMultiMode(); } }
//[Obsolete] void RPC_S2C_Plant_Water(uLink.BitStream stream, uLink.NetworkMessageInfo info) { int objId = stream.Read <int> (); double water = stream.Read <double> (); FarmPlantLogic plant = FarmManager.Instance.GetPlantByItemObjID(objId); if (plant != null) { plant.mWater = water; plant.UpdateInMultiMode(); } }
//[Obsolete] void RPC_S2C_Plant_FarmInfo(uLink.BitStream stream, uLink.NetworkMessageInfo info) { byte[] data = stream.Read <byte[]> (); List <FarmPlantInitData> initList = FarmManager.Instance.ImportPlantData(data); foreach (FarmPlantInitData plantData in initList) { ItemObject itemObj = ItemMgr.Instance.Get(plantData.mPlantInstanceId); DragArticleAgent dragItem = DragArticleAgent.Create(itemObj.GetCmpt <Drag>(), plantData.mPos, Vector3.one, plantData.mRot, plantData.mPlantInstanceId); FarmPlantLogic plant = dragItem.itemLogic as FarmPlantLogic; plant.InitDataFromPlant(plantData); FarmManager.Instance.AddPlant(plant); plant.UpdateInMultiMode(); } }