/// <summary> /// 请求同步操作 /// </summary> public virtual void RqSyncAction(int[] data) { EventIntArrayArgs args = new EventIntArrayArgs(); args.t = data; SyncController.instance.SendNetMsg(ProtoIDCfg.OBJECT_ACTION, args); }
/// <summary> /// 请求激活对象 /// </summary> void ReqActiveObject(EventArgs args) { EventIntArrayArgs intArgs = args as EventIntArrayArgs; if (intArgs != null && intArgs.t != null) { SendActiveObjectProto(intArgs.t); } }
/// <summary> /// 主机调用,请求销毁 /// </summary> public void ReqDestroy() { if (reqDestroying) { return; } reqDestroying = true; EventIntArrayArgs obj = new EventIntArrayArgs(); obj.t = new int[] { sync.serverID }; SyncController.instance.SendNetMsg(ProtoIDCfg.REMOVE_OBJECTS, obj); }
/// <summary> /// 请求删除对象 /// </summary> void ReqRemoveObject(EventArgs args) { EventIntArrayArgs objsEvent = args as EventIntArrayArgs; int[] t = objsEvent.t; if (t != null) { ProtoIntArray proto = ObjectPool.protoPool.GetOrCreate <ProtoIntArray>(ProtoPool.ProtoRecycleType.IntArray); proto.context = t; Send(ProtoIDCfg.REMOVE_OBJECTS, proto, ProtoType.Importance); proto.Recycle(); } }
public void CreatePrefab() { if (prefabs == null) { return; } int[] t = new int[prefabs.Length]; for (int i = 0; i < t.Length; i++) { t[i] = SyncCreater.instance.GetIndex(prefabs[i]); } EventIntArrayArgs e = new EventIntArrayArgs(); e.t = t; SceneController.instance.SendNetMsg(ProtoIDCfg.ACTIVE_OBJECTS, e); }
void CheckActiveObject() { //检查激活对象 if (activeTag != null) { for (int i = 0; i < activeTag.Length; i++) { if (activeTag[i] == false) { var acData = levelData.activeSets[i]; if (gameTime >= acData.time) { activeTag[i] = true; EventIntArrayArgs e = new EventIntArrayArgs(); e.t = acData.objectCfgs; SceneController.instance.SendNetMsg(ProtoIDCfg.ACTIVE_OBJECTS, e); } } } } }