/// 发送请求对象Proto void SendActiveObjectProto(int[] prefabIndexs) { ProtoIntArray p = ObjectPool.protoPool.GetOrCreate <ProtoIntArray>(ProtoPool.ProtoRecycleType.IntArray); p.context = prefabIndexs; Send(ProtoIDCfg.ACTIVE_OBJECTS, p, ProtoType.Importance); p.Recycle(); }
/// <summary> /// 同步行为 /// </summary> void OnObjectAction(byte[] data) { ProtoIntArray proto = ObjectPool.protoPool.GetOrCreate <ProtoIntArray>(ProtoPool.ProtoRecycleType.IntArray); if (proto.Parse(data)) { int[] ints = proto.context; SceneModel sceneModel = SceneController.instance.GetModel <SceneModel>(SceneModel.name); sceneModel.SetSceneObjectAciton(data[0], ints); } proto.Recycle(); }
/// <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(); } }
/// <summary> /// 移除对象 /// </summary> void OnRemoveObject(byte[] data) { ProtoIntArray proto = ObjectPool.protoPool.GetOrCreate <ProtoIntArray>(ProtoPool.ProtoRecycleType.IntArray); if (proto.Parse(data)) { int[] ints = proto.context; SceneModel sceneModel = SceneController.instance.GetModel <SceneModel>(SceneModel.name); for (int i = 0; i < ints.Length; i++) { SceneGameObject obj = sceneModel.GetSceneObject(ints[i]); if (obj != null) { obj.RemoveObject(); } } } proto.Recycle(); }