스토리 진행상황 저장 프로토콜 생성
This commit is contained in:
parent
46021cbb1e
commit
9d26d5dc06
|
|
@ -66,7 +66,7 @@ namespace Server.Service
|
||||||
SaveSQL();
|
SaveSQL();
|
||||||
NicknameChangeResp resp = new NicknameChangeResp();
|
NicknameChangeResp resp = new NicknameChangeResp();
|
||||||
resp.nickname = user.nickname;
|
resp.nickname = user.nickname;
|
||||||
resp.cash = (ulong)(user.free_cash + user.pay_cash);
|
resp.cash = (uint)(user.free_cash + user.pay_cash);
|
||||||
return resp.ToJson();
|
return resp.ToJson();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -85,6 +85,6 @@ namespace Server.Service
|
||||||
public class NicknameChangeResp : Resp
|
public class NicknameChangeResp : Resp
|
||||||
{
|
{
|
||||||
public string nickname;
|
public string nickname;
|
||||||
public ulong cash;
|
public uint cash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,73 @@
|
||||||
using Server.System;
|
using Server.System;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Server.SQL;
|
||||||
|
|
||||||
namespace Server.Service
|
namespace Server.Service
|
||||||
{
|
{
|
||||||
public class UpdateStory : AbstractService
|
public class UpdateStory : AbstractService
|
||||||
{
|
{
|
||||||
private UpdateStoryReq req;
|
private UpdateStoryReq req;
|
||||||
|
|
||||||
|
private void SaveSQL()
|
||||||
|
{
|
||||||
|
Statics.storyProgressSQL.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
public override string Process()
|
public override string Process()
|
||||||
{
|
{
|
||||||
return makeResp();
|
User user = Statics.userSQL.SelectUuid(req.uuid);
|
||||||
|
List<StoryProgress> storyProgress = Statics.storyProgressSQL.SelectUid(user.id);
|
||||||
|
StoryProgress story = storyProgress.Find(n => n.story_data_id == req.story_id);
|
||||||
|
int chapter = 1;
|
||||||
|
|
||||||
|
|
||||||
|
//정상적인 진행인지 확인
|
||||||
|
if (req.chapter_id != 1 && (story == null || story.chapter_data_id + 1 < req.chapter_id))
|
||||||
|
{
|
||||||
|
throw new RuntimeException("over chapter id", Error.ErrorData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.is_clear)
|
||||||
|
{
|
||||||
|
if (req.chapter_id == 1)
|
||||||
|
{
|
||||||
|
story = new StoryProgress();
|
||||||
|
story.user_id = user.id;
|
||||||
|
story.story_data_id = req.story_id;
|
||||||
|
story.chapter_data_id = req.chapter_id;
|
||||||
|
Statics.storyProgressSQL.Insert(story);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
story.chapter_data_id++;
|
||||||
|
chapter = story.chapter_data_id;
|
||||||
|
Statics.storyProgressSQL.Update(story);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//보상 지급 추가할것.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//클리어 실패 로그용
|
||||||
|
}
|
||||||
|
SaveSQL();
|
||||||
|
return makeResp(chapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Protocol ProtocolValue() => Protocol.UpdateStory;
|
public override Protocol ProtocolValue() => Protocol.UpdateStory;
|
||||||
|
|
||||||
public override Req Requst(string json)
|
public override Req Requst(string json)
|
||||||
{
|
{
|
||||||
if (req.is_clear)
|
|
||||||
{
|
|
||||||
//클리어
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//클리어 실패 로그용
|
|
||||||
}
|
|
||||||
req = JsonConvert.DeserializeObject<UpdateStoryReq>(json);
|
req = JsonConvert.DeserializeObject<UpdateStoryReq>(json);
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string makeResp()
|
private string makeResp(int chapter)
|
||||||
{
|
{
|
||||||
UpdateStoryResp resp = new UpdateStoryResp();
|
UpdateStoryResp resp = new UpdateStoryResp();
|
||||||
resp.status = 200;
|
resp.status = 200;
|
||||||
|
resp.chapter = chapter;
|
||||||
return resp.ToJson();
|
return resp.ToJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,8 +76,8 @@ namespace Server.Service
|
||||||
|
|
||||||
public class UpdateStoryReq : Req
|
public class UpdateStoryReq : Req
|
||||||
{
|
{
|
||||||
public long story_id;
|
public int story_id;
|
||||||
public long chapter_id;
|
public int chapter_id;
|
||||||
public bool is_clear;
|
public bool is_clear;
|
||||||
public override bool IsReceivedAllField()
|
public override bool IsReceivedAllField()
|
||||||
{
|
{
|
||||||
|
|
@ -52,6 +89,6 @@ namespace Server.Service
|
||||||
|
|
||||||
public class UpdateStoryResp : Resp
|
public class UpdateStoryResp : Resp
|
||||||
{
|
{
|
||||||
|
public int chapter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ namespace Server.System
|
||||||
public static EtcItemSQL etcItemSQL = new EtcItemSQL();
|
public static EtcItemSQL etcItemSQL = new EtcItemSQL();
|
||||||
public static ResetShopItemSQL resetShopItemSQL = new ResetShopItemSQL();
|
public static ResetShopItemSQL resetShopItemSQL = new ResetShopItemSQL();
|
||||||
public static ShopItemSQL shopItemSQL = new ShopItemSQL();
|
public static ShopItemSQL shopItemSQL = new ShopItemSQL();
|
||||||
|
public static StoryProgressSQL storyProgressSQL = new StoryProgressSQL();
|
||||||
|
|
||||||
//DATA
|
//DATA
|
||||||
public static EquipmentDataExcel equipmentExcel = new EquipmentDataExcel();
|
public static EquipmentDataExcel equipmentExcel = new EquipmentDataExcel();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue