From d4d3e986b320c7cf48d2de7b375ae02b9f639bb0 Mon Sep 17 00:00:00 2001 From: chen wei bo <1025839511@qq.com> Date: Mon, 8 Sep 2025 19:44:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/chat18x/config/PurchaseConfig.ts | 4 +- assets/Scripts/chat18x/data/ShopData.ts | 77 ++-- .../chat18x/network/services/ChatService.ts | 16 +- .../chat18x/network/services/GirlService.ts | 10 + .../network/services/HttpChatService.ts | 30 +- .../network/services/HttpGirlService.ts | 22 + .../network/services/HttpShopService.ts | 17 +- .../chat18x/network/services/IChatService.ts | 8 +- .../chat18x/network/services/IGirlService.ts | 4 + .../chat18x/network/services/IShopService.ts | 4 +- .../network/services/MockChatService.ts | 85 +++- .../network/services/MockGirlService.ts | 22 +- .../network/services/MockShopService.ts | 45 +- .../chat18x/network/services/ShopService.ts | 7 +- assets/Scripts/proto/proto.pb.d.ts | 188 ++++++++ assets/Scripts/proto/proto.pb.js | 403 ++++++++++++++++++ proto_cs | 2 +- 17 files changed, 878 insertions(+), 66 deletions(-) diff --git a/assets/Scripts/chat18x/config/PurchaseConfig.ts b/assets/Scripts/chat18x/config/PurchaseConfig.ts index 002a480d..0eaaaf84 100644 --- a/assets/Scripts/chat18x/config/PurchaseConfig.ts +++ b/assets/Scripts/chat18x/config/PurchaseConfig.ts @@ -61,7 +61,7 @@ export class PurchaseConfig extends BaseConfig { // 获取所有 id let resultId = []; for (let one of allId) { - const firstDigit = one.toString()[0]; + const firstDigit = one.toString()[0]; // 取首位字符 if (firstDigit === "2") { resultId.push(one); } @@ -76,7 +76,7 @@ export class PurchaseConfig extends BaseConfig { // 获取所有 id let resultId = []; for (let one of allId) { - const firstDigit = one.toString()[0]; + const firstDigit = one.toString()[0]; // 取首位字符 if (firstDigit === "3") { resultId.push(one); } diff --git a/assets/Scripts/chat18x/data/ShopData.ts b/assets/Scripts/chat18x/data/ShopData.ts index 49ef5850..cd365fc2 100644 --- a/assets/Scripts/chat18x/data/ShopData.ts +++ b/assets/Scripts/chat18x/data/ShopData.ts @@ -1,12 +1,12 @@ /** - * 商品数据 + * 商城数据 */ import { BaseData } from "./BaseData"; import proto from 'db://assets/Scripts/proto/proto.pb.js'; export class ShopData extends BaseData { // 商品数据 - private _goods = new Map(); + private _goods = new Map(); // 商品 id private _goodIds: number[] = []; @@ -27,17 +27,16 @@ export class ShopData extends BaseData { } /** 设置商品数据 */ - public set goods(res: proto.cs.ICSGetShopRes) { - const list = res.Goods ?? []; + public set goods(res: proto.cs.ICSGetPurchaseRes) { + const list = res.items ?? []; this._goods.clear(); this._goodIds = []; for (const g of list) { - const vo: proto.cs.IGood = { + const vo: proto.cs.IPurchaseConfig = { id: g.id, // 商品 id - name: g.name || "", // 商品名字 - desc: g.desc || "", // 商品描述 - price: g.price || "0.00", // 商品价格 - count: g.count || 0, // 商品数量 + name: g.name, // 商品名字 + count: g.count, // 商品数量 + price: g.price, // 商品价格 }; this._goods.set(vo.id, vo); this._goodIds.push(vo.id); @@ -46,7 +45,7 @@ export class ShopData extends BaseData { } /** 获取所有商品数据 */ - public get goods(): Map { return this._goods; } + public get goods(): Map { return this._goods; } /** 获取所有商品数据的数量 */ public get goodsCount(): number { return this._goods ? this._goods.size : 0; } @@ -54,18 +53,53 @@ export class ShopData extends BaseData { /** 获取所有商品 id */ public get goodIds(): number[] { return this._goodIds; } - /** 获取vip商品数据 */ - public get vipGoods(): proto.cs.IGood[] { - return this._goodIds.map(id => this._goods.get(id)!).filter(g => g.id > 2000); + /** 获取 充值商品的id数组,首位数字为 1 */ + private getRechargeIds(): number[] { + let allId = this._goodIds; + if (!allId) return []; + // 获取所有 id + let resultId = []; + for (let one of allId) { + const firstDigit = one.toString()[0]; // 取首位字符 + if (firstDigit === "1") { + resultId.push(one); + } + } + return resultId; } - /** 获取普通商品数据 */ - public get normalGoods(): proto.cs.IGood[] { - return this._goodIds.map(id => this._goods.get(id)!).filter(g => g.id <= 2000); + /** 获取 会员商品的id数组,首位数字为 2 */ + private getMemberIds(): number[] { + let allId = this._goodIds; + if (!allId) return []; + // 获取所有 id + let resultId = []; + for (let one of allId) { + const firstDigit = one.toString()[0]; // 取首位字符 + if (firstDigit === "2") { + resultId.push(one); + } + } + return resultId; } + /** 获取 聊天商品的id数组,首位数字为 3 */ + private getChatIds(): number[] { + let allId = this._goodIds; + if (!allId) return []; + // 获取所有 id + let resultId = []; + for (let one of allId) { + const firstDigit = one.toString()[0]; // 取首位字符 + if (firstDigit === "3") { + resultId.push(one); + } + } + return resultId; + } + /** 根据商品 id 获取商品数据 */ - private getGoodDataById(id: number): proto.cs.IGood | null { + private getGoodDataById(id: number): proto.cs.IPurchaseConfig | null { if (!this._goods) return null; return this._goods.get(id) ?? null; } @@ -77,15 +111,8 @@ export class ShopData extends BaseData { return oneData.name; } - /** 根据商品 id 获取商品描述 */ - public getDescById(id: number): string | null { - let oneData = this.getGoodDataById(id); - if (!oneData) return null; - return oneData.desc; - } - /** 根据商品 id 获取商品价格 */ - public getPriceById(id: number): string | null { + public getPriceById(id: number): number | null { let oneData = this.getGoodDataById(id); if (!oneData) return null; return oneData.price; diff --git a/assets/Scripts/chat18x/network/services/ChatService.ts b/assets/Scripts/chat18x/network/services/ChatService.ts index 9f6e8832..f718e231 100644 --- a/assets/Scripts/chat18x/network/services/ChatService.ts +++ b/assets/Scripts/chat18x/network/services/ChatService.ts @@ -26,8 +26,18 @@ export class ChatService implements IChatService { this.impl = useMock ? new MockChatService() : new HttpChatService(); } - // 对外 API 保持不变 - public async reqBuyChat(req: proto.cs.ICSBuyChatReq): Promise> { - return this.impl.reqBuyChat(req); + // 上报聊天数据 + public async reqChatMsg(req: proto.cs.ICSChatMsgReq): Promise> { + return this.impl.reqChatMsg(req); } + + // 获取聊天数据 + public async reqGetChatMsg(req: proto.cs.ICSGetChatMsgReq): Promise> { + return this.impl.reqGetChatMsg(req); + } + + // 获取技师聊天次数 + public async reqChatCountData(req: proto.cs.ICSGetChatRemainCountReq): Promise> { + return this.impl.reqChatCountData(req); + } } diff --git a/assets/Scripts/chat18x/network/services/GirlService.ts b/assets/Scripts/chat18x/network/services/GirlService.ts index f948fd28..777a933c 100644 --- a/assets/Scripts/chat18x/network/services/GirlService.ts +++ b/assets/Scripts/chat18x/network/services/GirlService.ts @@ -38,4 +38,14 @@ export class GirlService implements IGirlService { public async reqGetGirlDetail(req: proto.cs.ICSGetGirlDetailReq): Promise> { return this.impl.reqGetGirlDetail(req); } + + // 解锁技师 + public async reqUnlockGirl(req: proto.cs.ICSUnlockGirlReq): Promise> { + return this.impl.reqUnlockGirl(req); + } + + // 解锁资源 + public async reqUnlockGirlRes(req: proto.cs.ICSUnlockResourceReq): Promise> { + return this.impl.reqUnlockGirlRes(req); + } } diff --git a/assets/Scripts/chat18x/network/services/HttpChatService.ts b/assets/Scripts/chat18x/network/services/HttpChatService.ts index 2f9bcbfa..ae67fd57 100644 --- a/assets/Scripts/chat18x/network/services/HttpChatService.ts +++ b/assets/Scripts/chat18x/network/services/HttpChatService.ts @@ -7,14 +7,36 @@ import type { IChatService } from "./IChatService"; export class HttpChatService implements IChatService { constructor(private api = ApiClient.I) {} - // 购买聊天次数 - async reqBuyChat(req: proto.cs.ICSBuyChatReq): Promise> { - const ep: Endpoint = { - path: "api/logic/buyChat", + // 上报聊天数据 + async reqChatMsg(req: proto.cs.ICSChatMsgReq): Promise> { + const ep: Endpoint = { + path: "api/logic/chatMsg", method: "POST", codec: "json", needsAuth: true, }; return this.api.call(ep, req); } + + // 获取聊天数据 + async reqGetChatMsg(req: proto.cs.ICSGetChatMsgReq): Promise> { + const ep: Endpoint = { + path: "api/logic/getChatMsg", + method: "POST", + codec: "json", + needsAuth: true, + }; + return this.api.call(ep, req); + } + + // 获取技师聊天次数 + async reqChatCountData(req: proto.cs.ICSGetChatRemainCountReq): Promise> { + const ep: Endpoint = { + path: "api/logic/getChatRemainCount", + method: "POST", + codec: "json", + needsAuth: true, + }; + return this.api.call(ep, req); + } } diff --git a/assets/Scripts/chat18x/network/services/HttpGirlService.ts b/assets/Scripts/chat18x/network/services/HttpGirlService.ts index 7b1e11c3..f1f32ae0 100644 --- a/assets/Scripts/chat18x/network/services/HttpGirlService.ts +++ b/assets/Scripts/chat18x/network/services/HttpGirlService.ts @@ -39,4 +39,26 @@ export class HttpGirlService implements IGirlService { }; return this.api.call(epData, req); } + + // 解锁技师 + async reqUnlockGirl(req: proto.cs.ICSUnlockGirlReq): Promise> { + let epData: Endpoint = { + path: "api/logic/unlockGirl", + method: "POST", + codec: "json", + needsAuth: true + }; + return this.api.call(epData, req); + } + + // 解锁资源 + async reqUnlockGirlRes(req: proto.cs.ICSUnlockResourceReq): Promise> { + let epData: Endpoint = { + path: "api/logic/unlockResource", + method: "POST", + codec: "json", + needsAuth: true + }; + return this.api.call(epData, req); + } } diff --git a/assets/Scripts/chat18x/network/services/HttpShopService.ts b/assets/Scripts/chat18x/network/services/HttpShopService.ts index 95b6860a..d6894303 100644 --- a/assets/Scripts/chat18x/network/services/HttpShopService.ts +++ b/assets/Scripts/chat18x/network/services/HttpShopService.ts @@ -8,13 +8,24 @@ export class HttpShopService implements IShopService { constructor(private api = ApiClient.I) {} // 获取商品列表 - async reqShopList(req: proto.cs.ICSGetShopReq): Promise> { - const ep: Endpoint = { - path: "api/logic/shop", + async reqShopList(req: proto.cs.ICSGetPurchaseReq): Promise> { + const ep: Endpoint = { + path: "api/logic/getPurchase", method: "POST", codec: "json", needsAuth: true, }; return this.api.call(ep, req); } + + // 使用余额购买商品 + async reqBuyGood(req: proto.cs.ICSBuyGoodReq): Promise> { + const ep: Endpoint = { + path: "api/logic/buyGood", + method: "POST", + codec: "json", + needsAuth: true, + }; + return this.api.call(ep, req); + } } diff --git a/assets/Scripts/chat18x/network/services/IChatService.ts b/assets/Scripts/chat18x/network/services/IChatService.ts index f53151cd..6f4e19a6 100644 --- a/assets/Scripts/chat18x/network/services/IChatService.ts +++ b/assets/Scripts/chat18x/network/services/IChatService.ts @@ -3,6 +3,10 @@ import type { ApiResponse } from "../client/types"; import proto from "db://assets/Scripts/proto/proto.pb.js"; export interface IChatService { - // 购买聊天次数 - reqBuyChat(req: proto.cs.ICSBuyChatReq): Promise>; + // 上报聊天数据 + reqChatMsg(req: proto.cs.ICSChatMsgReq): Promise>; + // 获取聊天数据 + reqGetChatMsg(req: proto.cs.ICSGetChatMsgReq): Promise>; + // 获取技师聊天次数 + reqChatCountData(req: proto.cs.ICSGetChatRemainCountReq): Promise>; } diff --git a/assets/Scripts/chat18x/network/services/IGirlService.ts b/assets/Scripts/chat18x/network/services/IGirlService.ts index 5115b98b..5351022b 100644 --- a/assets/Scripts/chat18x/network/services/IGirlService.ts +++ b/assets/Scripts/chat18x/network/services/IGirlService.ts @@ -8,4 +8,8 @@ export interface IGirlService { reqGetGirlList(req: proto.cs.ICSGetGirlListReq): Promise>; // 获取技师详细信息 reqGetGirlDetail(req: proto.cs.ICSGetGirlDetailReq): Promise>; + // 解锁技师 + reqUnlockGirl(req: proto.cs.ICSUnlockGirlReq): Promise>; + // 解锁资源 + reqUnlockGirlRes(req: proto.cs.ICSUnlockResourceReq): Promise>; } diff --git a/assets/Scripts/chat18x/network/services/IShopService.ts b/assets/Scripts/chat18x/network/services/IShopService.ts index e426cac9..fd2e4277 100644 --- a/assets/Scripts/chat18x/network/services/IShopService.ts +++ b/assets/Scripts/chat18x/network/services/IShopService.ts @@ -3,5 +3,7 @@ import proto from "db://assets/Scripts/proto/proto.pb.js"; export interface IShopService { // 获取商品列表 - reqShopList(req: proto.cs.ICSGetShopReq): Promise>; + reqShopList(req: proto.cs.ICSGetPurchaseReq): Promise>; + // 使用余额购买商品 + reqBuyGood(req: proto.cs.ICSBuyGoodReq): Promise>; } diff --git a/assets/Scripts/chat18x/network/services/MockChatService.ts b/assets/Scripts/chat18x/network/services/MockChatService.ts index 995ee7c9..5b7e4871 100644 --- a/assets/Scripts/chat18x/network/services/MockChatService.ts +++ b/assets/Scripts/chat18x/network/services/MockChatService.ts @@ -1,22 +1,91 @@ import type { ApiResponse } from "../client/types"; import proto from "db://assets/Scripts/proto/proto.pb.js"; import type { IChatService } from "./IChatService"; +import { DataManager, DataId } from "../../data/DataManager"; +import { GirlData } from "../../data/GirlData"; export class MockChatService implements IChatService { private delay(ms = 160) { return new Promise(r => setTimeout(r, ms)); } - // 按你们项目的 ApiResponse 结构调整这里即可 private ok(data: T): ApiResponse { - return ({ ok: true, data } as unknown) as ApiResponse; + return ({ code: proto.cs.EnmRetCode.SUCCESS, data } as unknown) as ApiResponse; } - // private err(message = "mock buyChat error"): ApiResponse { - // return ({ ok: false, error: { message } } as unknown) as ApiResponse; - // } - async reqBuyChat(_req: proto.cs.ICSBuyChatReq): Promise> { + // 上报聊天数据 + async reqChatMsg(req: proto.cs.ICSChatMsgReq): Promise> { + // 延时 await this.delay(); - // CSBuyChatRes 在 proto 中为空消息,这里返回 {} - const res: proto.cs.ICSBuyChatRes = {}; + // 请求数据 + const reqGirlId = req.girlId; + // 数据层的数据 + const girlData = DataManager.I.getDataById(DataId.Girl); + const reqGirlCategory = girlData.getGrilCategoryById(reqGirlId); + const chatTotalCount = girlData.getChatTotalCount(reqGirlCategory.toString(), reqGirlId); + const chatRemainCount = girlData.getChatRemainCount(reqGirlCategory.toString(), reqGirlId); + // 计算 + let resultTotalCount = chatTotalCount + 1; + let resultRemainCount = chatRemainCount; + if (chatRemainCount > 0) { + resultRemainCount = chatRemainCount - 1; + } + // 返回数据 + const res: proto.cs.ICSChatMsgRes = { + chatRemainCount: resultRemainCount, + chatTotalCount: resultTotalCount, + }; return this.ok(res); } + + // 获取聊天数据 + async reqGetChatMsg(req: proto.cs.ICSGetChatMsgReq): Promise> { + // 延时 + await this.delay(); + // 请求数据 + const reqGirlId = req.GirlId; + const page = req.page; + const limit = req.limit; + // 数据层的数据 + const girlData = DataManager.I.getDataById(DataId.Girl); + const reqGirlCategory = girlData.getGrilCategoryById(reqGirlId); + const chatTotalCount = girlData.getChatTotalCount(reqGirlCategory.toString(), reqGirlId); + const chatRemainCount = girlData.getChatRemainCount(reqGirlCategory.toString(), reqGirlId); + // 模拟一个完整的聊天记录池 + const allMsgs: proto.cs.IChatMsg[] = []; + for (let i = 0; i < 50; i++) { + allMsgs.push({ + msg: `模拟消息 ${i + 1} 来自技师 ${reqGirlId}`, + isAi: i % 2 === 0, // 偶数条当成 AI 说的 + }); + } + // 分页计算 + const start = (page - 1) * limit; + const end = start + limit; + const pageMsgs = allMsgs.slice(start, end); + // 返回数据 + const res: proto.cs.ICSGetChatMsgRes = { + msgs: pageMsgs, + chatRemainCount, + chatTotalCount, + }; + return this.ok(res); + } + + // 获取技师聊天次数 + async reqChatCountData(req: proto.cs.ICSGetChatRemainCountReq): Promise> { + // 延时 + await this.delay(); + // 请求数据 + const reqGirlId = req.id; + // 数据层的数据 + const girlData = DataManager.I.getDataById(DataId.Girl); + const reqGirlCategory = girlData.getGrilCategoryById(reqGirlId); + const chatTotalCount = girlData.getChatTotalCount(reqGirlCategory.toString(), reqGirlId); + const chatRemainCount = girlData.getChatRemainCount(reqGirlCategory.toString(), reqGirlId); + // 返回数据 + const res: proto.cs.ICSGetChatRemainCountRes = { + chatRemainCount, + chatTotalCount, + }; + return this.ok(res); + } } diff --git a/assets/Scripts/chat18x/network/services/MockGirlService.ts b/assets/Scripts/chat18x/network/services/MockGirlService.ts index 86aac2ef..e00cc458 100644 --- a/assets/Scripts/chat18x/network/services/MockGirlService.ts +++ b/assets/Scripts/chat18x/network/services/MockGirlService.ts @@ -226,12 +226,30 @@ export class MockGirlService implements IGirlService { } const star = 3; - const chatTotalCount = 10; - const chatRemainCount = 10; + const chatTotalCount = 20; + const chatRemainCount = 20; const girlData = this.genGirlData(girlId, briefData, isRelease, star, detail, unlockImageData, unlockVideoData, chatTotalCount, chatRemainCount); // 返回数据 const res: proto.cs.ICSGetGirlDetailRes = {girl: girlData}; return this.ok(res); } + + // 解锁技师 + async reqUnlockGirl(_req: proto.cs.ICSUnlockGirlReq): Promise> { + // 延时 + await this.delay(180); + // 返回数据 + const res: proto.cs.ICSUnlockGirlRes = {}; + return this.ok(res); + } + + // 解锁资源 + async reqUnlockGirlRes(_req: proto.cs.ICSUnlockResourceReq): Promise> { + // 延时 + await this.delay(180); + // 返回数据 + const res: proto.cs.ICSUnlockResourceRes = {}; + return this.ok(res); + } } diff --git a/assets/Scripts/chat18x/network/services/MockShopService.ts b/assets/Scripts/chat18x/network/services/MockShopService.ts index dd96c5c9..44613d99 100644 --- a/assets/Scripts/chat18x/network/services/MockShopService.ts +++ b/assets/Scripts/chat18x/network/services/MockShopService.ts @@ -1,6 +1,8 @@ import type { ApiResponse } from "../client/types"; import proto from "db://assets/Scripts/proto/proto.pb.js"; import type { IShopService } from "./IShopService"; +import { PurchaseConfig } from "../../config/PurchaseConfig"; +import { ConfigManager, ConfigId } from "../../manager/ConfigManager"; export class MockShopService implements IShopService { private delay(ms = 180) { return new Promise(r => setTimeout(r, ms)); } @@ -11,29 +13,44 @@ export class MockShopService implements IShopService { } private ok(data: T): ApiResponse { - return ({ ok: true, data } as unknown) as ApiResponse; + return ({ code: proto.cs.EnmRetCode.SUCCESS, data } as unknown) as ApiResponse; } - private genGood(id: number, vip = false): proto.cs.IGood { + private genGood(id: number, name: string, count: number, price: number): proto.cs.IPurchaseConfig { return { id, - name: vip ? `VIP-${id}` : `Diamond Pack ${id}`, - desc: vip ? `VIP access for ${this.randInt(24, 168)} hours` : `Diamonds x${this.randInt(60, 2000)}`, - price: this.priceUSD(vip ? 4.99 : 0.99, vip ? 49.99 : 29.99), - count: vip ? this.randInt(24, 168) : this.randInt(60, 2000), // VIP=小时,普通=数量 + name, + count, + price, }; } // 获取商品列表 - async reqShopList(_req: proto.cs.ICSGetShopReq): Promise> { + async reqShopList(_req: proto.cs.ICSGetPurchaseReq): Promise> { + // 延时 await this.delay(); - - // 普通商品(<=2000)+ VIP 商品(>2000) - const normals: proto.cs.IGood[] = Array.from({ length: 5 }, (_, i) => this.genGood(1000 + i, false)); - const vips: proto.cs.IGood[] = Array.from({ length: 3 }, (_, i) => this.genGood(2001 + i, true)); - - // 注意:你的 proto 定义中字段名为 "Goods"(大写 G) - const res: proto.cs.ICSGetShopRes = { Goods: [...normals, ...vips] }; + // 配置数据 + const configData = ConfigManager.I.getDataById(ConfigId.Purchase); + const allId = configData.getAllId(); + let goodData: proto.cs.IPurchaseConfig[] = []; + for (let id of allId) { + let name = configData.getNameById(id); + let count = configData.getCountById(id); + let price = configData.getPriceById(id); + let oneData = this.genGood(id, name, count, price); + goodData.push(oneData); + } + // 返回数据 + const res: proto.cs.ICSGetPurchaseRes = { items: goodData }; return this.ok(res); } + + // 使用余额购买商品 + async reqBuyGood(_req: proto.cs.ICSBuyGoodReq): Promise> { + // 延时 + await this.delay(); + // 返回数据 + const res: proto.cs.ICSBuyGoodRes = {}; + return this.ok(res); + } } diff --git a/assets/Scripts/chat18x/network/services/ShopService.ts b/assets/Scripts/chat18x/network/services/ShopService.ts index c4caeb6c..9d65e3ed 100644 --- a/assets/Scripts/chat18x/network/services/ShopService.ts +++ b/assets/Scripts/chat18x/network/services/ShopService.ts @@ -26,7 +26,12 @@ export class ShopService implements IShopService { } // 获取商品列表 - public async reqShopList(req: proto.cs.ICSGetShopReq): Promise> { + public async reqShopList(req: proto.cs.ICSGetPurchaseReq): Promise> { return this.impl.reqShopList(req); } + + // 使用余额购买商品 + public async reqBuyGood(req: proto.cs.ICSBuyGoodReq): Promise> { + return this.impl.reqBuyGood(req); + } } diff --git a/assets/Scripts/proto/proto.pb.d.ts b/assets/Scripts/proto/proto.pb.d.ts index c9b3ce0a..a93fd73e 100644 --- a/assets/Scripts/proto/proto.pb.d.ts +++ b/assets/Scripts/proto/proto.pb.d.ts @@ -2951,6 +2951,194 @@ toJSON(): { [k: string]: any }; static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a CSGetPurchaseReq. */ + interface ICSGetPurchaseReq { + } + + /** Represents a CSGetPurchaseReq. */ + class CSGetPurchaseReq implements ICSGetPurchaseReq { + + /** + * Constructs a new CSGetPurchaseReq. + * @param [properties] Properties to set + */ + constructor(properties?: cs.ICSGetPurchaseReq); + + /** + * Creates a new CSGetPurchaseReq instance using the specified properties. + * @param [properties] Properties to set + * @returns CSGetPurchaseReq instance + */ +static create(properties?: cs.ICSGetPurchaseReq): cs.CSGetPurchaseReq; + + /** + * Encodes the specified CSGetPurchaseReq message. Does not implicitly {@link cs.CSGetPurchaseReq.verify|verify} messages. + * @param message CSGetPurchaseReq message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ +static encode(message: cs.ICSGetPurchaseReq, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CSGetPurchaseReq message, length delimited. Does not implicitly {@link cs.CSGetPurchaseReq.verify|verify} messages. + * @param message CSGetPurchaseReq message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ +static encodeDelimited(message: cs.ICSGetPurchaseReq, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CSGetPurchaseReq message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CSGetPurchaseReq + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ +static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): cs.CSGetPurchaseReq; + + /** + * Decodes a CSGetPurchaseReq message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CSGetPurchaseReq + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ +static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): cs.CSGetPurchaseReq; + + /** + * Verifies a CSGetPurchaseReq message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ +static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CSGetPurchaseReq message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CSGetPurchaseReq + */ +static fromObject(object: { [k: string]: any }): cs.CSGetPurchaseReq; + + /** + * Creates a plain object from a CSGetPurchaseReq message. Also converts values to other types if specified. + * @param message CSGetPurchaseReq + * @param [options] Conversion options + * @returns Plain object + */ +static toObject(message: cs.CSGetPurchaseReq, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CSGetPurchaseReq to JSON. + * @returns JSON object + */ +toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CSGetPurchaseReq + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ +static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CSGetPurchaseRes. */ + interface ICSGetPurchaseRes { + + /** CSGetPurchaseRes items */ + items?: (cs.IPurchaseConfig[]|null); + } + + /** Represents a CSGetPurchaseRes. */ + class CSGetPurchaseRes implements ICSGetPurchaseRes { + + /** + * Constructs a new CSGetPurchaseRes. + * @param [properties] Properties to set + */ + constructor(properties?: cs.ICSGetPurchaseRes); + + /** CSGetPurchaseRes items. */ +items: cs.IPurchaseConfig[]; + + /** + * Creates a new CSGetPurchaseRes instance using the specified properties. + * @param [properties] Properties to set + * @returns CSGetPurchaseRes instance + */ +static create(properties?: cs.ICSGetPurchaseRes): cs.CSGetPurchaseRes; + + /** + * Encodes the specified CSGetPurchaseRes message. Does not implicitly {@link cs.CSGetPurchaseRes.verify|verify} messages. + * @param message CSGetPurchaseRes message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ +static encode(message: cs.ICSGetPurchaseRes, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CSGetPurchaseRes message, length delimited. Does not implicitly {@link cs.CSGetPurchaseRes.verify|verify} messages. + * @param message CSGetPurchaseRes message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ +static encodeDelimited(message: cs.ICSGetPurchaseRes, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CSGetPurchaseRes message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CSGetPurchaseRes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ +static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): cs.CSGetPurchaseRes; + + /** + * Decodes a CSGetPurchaseRes message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CSGetPurchaseRes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ +static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): cs.CSGetPurchaseRes; + + /** + * Verifies a CSGetPurchaseRes message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ +static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CSGetPurchaseRes message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CSGetPurchaseRes + */ +static fromObject(object: { [k: string]: any }): cs.CSGetPurchaseRes; + + /** + * Creates a plain object from a CSGetPurchaseRes message. Also converts values to other types if specified. + * @param message CSGetPurchaseRes + * @param [options] Conversion options + * @returns Plain object + */ +static toObject(message: cs.CSGetPurchaseRes, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CSGetPurchaseRes to JSON. + * @returns JSON object + */ +toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CSGetPurchaseRes + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ +static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Category enum. */ enum Category { Category_mature = 0, diff --git a/assets/Scripts/proto/proto.pb.js b/assets/Scripts/proto/proto.pb.js index ab3d1be5..820d2843 100644 --- a/assets/Scripts/proto/proto.pb.js +++ b/assets/Scripts/proto/proto.pb.js @@ -6625,6 +6625,409 @@ $root.cs = (function() { return CSGetResConfigRes; })(); + cs.CSGetPurchaseReq = (function() { + + /** + * Properties of a CSGetPurchaseReq. + * @memberof cs + * @interface ICSGetPurchaseReq + */ + + /** + * Constructs a new CSGetPurchaseReq. + * @memberof cs + * @classdesc Represents a CSGetPurchaseReq. + * @implements ICSGetPurchaseReq + * @constructor + * @param {cs.ICSGetPurchaseReq=} [properties] Properties to set + */ + function CSGetPurchaseReq(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new CSGetPurchaseReq instance using the specified properties. + * @function create + * @memberof cs.CSGetPurchaseReq + * @static + * @param {cs.ICSGetPurchaseReq=} [properties] Properties to set + * @returns {cs.CSGetPurchaseReq} CSGetPurchaseReq instance + */ + CSGetPurchaseReq.create = function create(properties) { + return new CSGetPurchaseReq(properties); + }; + + /** + * Encodes the specified CSGetPurchaseReq message. Does not implicitly {@link cs.CSGetPurchaseReq.verify|verify} messages. + * @function encode + * @memberof cs.CSGetPurchaseReq + * @static + * @param {cs.ICSGetPurchaseReq} message CSGetPurchaseReq message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CSGetPurchaseReq.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified CSGetPurchaseReq message, length delimited. Does not implicitly {@link cs.CSGetPurchaseReq.verify|verify} messages. + * @function encodeDelimited + * @memberof cs.CSGetPurchaseReq + * @static + * @param {cs.ICSGetPurchaseReq} message CSGetPurchaseReq message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CSGetPurchaseReq.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CSGetPurchaseReq message from the specified reader or buffer. + * @function decode + * @memberof cs.CSGetPurchaseReq + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cs.CSGetPurchaseReq} CSGetPurchaseReq + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CSGetPurchaseReq.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cs.CSGetPurchaseReq(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CSGetPurchaseReq message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cs.CSGetPurchaseReq + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cs.CSGetPurchaseReq} CSGetPurchaseReq + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CSGetPurchaseReq.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CSGetPurchaseReq message. + * @function verify + * @memberof cs.CSGetPurchaseReq + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CSGetPurchaseReq.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a CSGetPurchaseReq message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cs.CSGetPurchaseReq + * @static + * @param {Object.} object Plain object + * @returns {cs.CSGetPurchaseReq} CSGetPurchaseReq + */ + CSGetPurchaseReq.fromObject = function fromObject(object) { + if (object instanceof $root.cs.CSGetPurchaseReq) + return object; + return new $root.cs.CSGetPurchaseReq(); + }; + + /** + * Creates a plain object from a CSGetPurchaseReq message. Also converts values to other types if specified. + * @function toObject + * @memberof cs.CSGetPurchaseReq + * @static + * @param {cs.CSGetPurchaseReq} message CSGetPurchaseReq + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CSGetPurchaseReq.toObject = function toObject() { + return {}; + }; + + /** + * Converts this CSGetPurchaseReq to JSON. + * @function toJSON + * @memberof cs.CSGetPurchaseReq + * @instance + * @returns {Object.} JSON object + */ + CSGetPurchaseReq.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CSGetPurchaseReq + * @function getTypeUrl + * @memberof cs.CSGetPurchaseReq + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CSGetPurchaseReq.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/cs.CSGetPurchaseReq"; + }; + + return CSGetPurchaseReq; + })(); + + cs.CSGetPurchaseRes = (function() { + + /** + * Properties of a CSGetPurchaseRes. + * @memberof cs + * @interface ICSGetPurchaseRes + * @property {Array.|null} [items] CSGetPurchaseRes items + */ + + /** + * Constructs a new CSGetPurchaseRes. + * @memberof cs + * @classdesc Represents a CSGetPurchaseRes. + * @implements ICSGetPurchaseRes + * @constructor + * @param {cs.ICSGetPurchaseRes=} [properties] Properties to set + */ + function CSGetPurchaseRes(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CSGetPurchaseRes items. + * @member {Array.} items + * @memberof cs.CSGetPurchaseRes + * @instance + */ + CSGetPurchaseRes.prototype.items = $util.emptyArray; + + /** + * Creates a new CSGetPurchaseRes instance using the specified properties. + * @function create + * @memberof cs.CSGetPurchaseRes + * @static + * @param {cs.ICSGetPurchaseRes=} [properties] Properties to set + * @returns {cs.CSGetPurchaseRes} CSGetPurchaseRes instance + */ + CSGetPurchaseRes.create = function create(properties) { + return new CSGetPurchaseRes(properties); + }; + + /** + * Encodes the specified CSGetPurchaseRes message. Does not implicitly {@link cs.CSGetPurchaseRes.verify|verify} messages. + * @function encode + * @memberof cs.CSGetPurchaseRes + * @static + * @param {cs.ICSGetPurchaseRes} message CSGetPurchaseRes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CSGetPurchaseRes.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.cs.PurchaseConfig.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CSGetPurchaseRes message, length delimited. Does not implicitly {@link cs.CSGetPurchaseRes.verify|verify} messages. + * @function encodeDelimited + * @memberof cs.CSGetPurchaseRes + * @static + * @param {cs.ICSGetPurchaseRes} message CSGetPurchaseRes message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CSGetPurchaseRes.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CSGetPurchaseRes message from the specified reader or buffer. + * @function decode + * @memberof cs.CSGetPurchaseRes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {cs.CSGetPurchaseRes} CSGetPurchaseRes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CSGetPurchaseRes.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cs.CSGetPurchaseRes(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.cs.PurchaseConfig.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CSGetPurchaseRes message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof cs.CSGetPurchaseRes + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {cs.CSGetPurchaseRes} CSGetPurchaseRes + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CSGetPurchaseRes.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CSGetPurchaseRes message. + * @function verify + * @memberof cs.CSGetPurchaseRes + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CSGetPurchaseRes.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.cs.PurchaseConfig.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a CSGetPurchaseRes message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof cs.CSGetPurchaseRes + * @static + * @param {Object.} object Plain object + * @returns {cs.CSGetPurchaseRes} CSGetPurchaseRes + */ + CSGetPurchaseRes.fromObject = function fromObject(object) { + if (object instanceof $root.cs.CSGetPurchaseRes) + return object; + var message = new $root.cs.CSGetPurchaseRes(); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".cs.CSGetPurchaseRes.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".cs.CSGetPurchaseRes.items: object expected"); + message.items[i] = $root.cs.PurchaseConfig.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CSGetPurchaseRes message. Also converts values to other types if specified. + * @function toObject + * @memberof cs.CSGetPurchaseRes + * @static + * @param {cs.CSGetPurchaseRes} message CSGetPurchaseRes + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CSGetPurchaseRes.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.cs.PurchaseConfig.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this CSGetPurchaseRes to JSON. + * @function toJSON + * @memberof cs.CSGetPurchaseRes + * @instance + * @returns {Object.} JSON object + */ + CSGetPurchaseRes.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CSGetPurchaseRes + * @function getTypeUrl + * @memberof cs.CSGetPurchaseRes + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CSGetPurchaseRes.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/cs.CSGetPurchaseRes"; + }; + + return CSGetPurchaseRes; + })(); + /** * Category enum. * @name cs.Category diff --git a/proto_cs b/proto_cs index 667f36bd..984b9da4 160000 --- a/proto_cs +++ b/proto_cs @@ -1 +1 @@ -Subproject commit 667f36bd33dd72e2d585ecc57d0783dca347dbf3 +Subproject commit 984b9da4046b12f7ee336664cfa28f6165286c0d