public void OnLoadSucc(FreeMoveEntity freeEntity, UnityObject unityObj) { if (null == freeEntity) { Logger.Error("source is not free move entity "); return; } var go = unityObj.AsGameObject; if (null == go) { Logger.Error("model is null"); return; } var target = FreeObjectGoAssemble.Assemble(unityObj, freeEntity); freeEntity.AddUnityGameObject(unityObj); var colGo = go.transform.Find(SceneObjectConstant.NormalColliderName); if (null != colGo) { colGo.GetComponent <Collider>().enabled = true; } else { Logger.ErrorFormat("no normal collider in {0}", go.name); } if (null != target) { if (freeEntity.hasEntityKey) { FreeObjectCastData.Make(target, freeEntity.entityKey.Value.EntityId); } else { Logger.Error("free entity has no entity key"); } } else { Logger.Error("target from FreeObjectGoAssemble is null"); } }
protected override void DoSetData(PointerData data) { var player = _playerContext.flagSelfEntity; if (null == player) { Logger.Error("player self entity is null "); } var freeMoveEntity = _freeMoveContext.GetEntityWithEntityKey(new EntityKey(FreeObjectCastData.EntityId(data.IdList), (short)EEntityType.FreeMove)); if (null == freeMoveEntity) { Logger.Error("free move entity is null !"); return; } if (IsUntouchableOffGround(player, freeMoveEntity.position.Value, freeMoveEntity.unityGameObject.UnityObject)) { Tip = ""; return; } switch (freeMoveEntity.freeData.Cat) { case FreeEntityConstant.DeadBoxGroup: if (freeMoveEntity.hasFreeData) { var freeDataValue = freeMoveEntity.freeData.Value; if (StringUtil.IsNullOrEmpty(freeDataValue)) { Logger.Error("dead box free data value is missing."); } else { Tip = string.Format(ScriptLocalization.client_actiontip.deadbox, freeDataValue); } } else { Logger.Error("no free data attached to free move entity "); } break; case FreeEntityConstant.DropBoxGroup: Tip = ScriptLocalization.client_actiontip.dropbox; break; default: Tip = ""; Logger.ErrorFormat("illegal category {0}", freeMoveEntity.freeData.Cat); break; } }