Commit 1cd5d12a authored by hex's avatar hex

Remove local ocgcore wrapper; disable AI/puzzle on iOS

parent bd251b82
......@@ -516,12 +516,12 @@ public class Menu : WindowServantSP
void onClickAI()
{
Program.I().shiftToServant(Program.I().aiRoom);
RMSshow_none(InterString.Get("本地AI模式已移除(仅支持联机对战)。"));
}
void onClickPizzle()
{
Program.I().shiftToServant(Program.I().puzzleMode);
RMSshow_none(InterString.Get("残局模式已移除(仅支持联机对战)。"));
}
void onClickReplay()
......
......@@ -49,24 +49,7 @@ public class AIRoom : WindowServantSP
{
return;
}
int l = 8000;
try
{
l = int.Parse(UIHelper.getByName<UIInput>(gameObject, "life_").value);
}
catch (Exception)
{
}
string aideck = "";
if (Config.Get("list_aideck", suiji) == suiji)
{
aideck= "ai/ydk/" + list_aideck.items[UnityEngine.Random.Range(1, list_aideck.items.Count)] + ".ydk";
}
else
{
aideck = "ai/ydk/" + Config.Get("list_aideck", suiji) + ".ydk";
}
launch("deck/" + Config.Get("deckInUse", "miaowu") + ".ydk", aideck, "ai/" + Config.Get("list_airank", "ai") + ".lua", UIHelper.getByName<UIToggle>(gameObject, "first_").value, UIHelper.getByName<UIToggle>(gameObject, "unrand_").value, l, UIHelper.getByName<UIToggle>(gameObject, "god_").value, UIHelper.getByName<UIToggle>(gameObject, "mr4_").value ? 4 : 3);
RMSshow_none(InterString.Get("本地AI模式已移除(仅支持联机对战)。"));
}
void printFile()
......@@ -148,17 +131,9 @@ public class AIRoom : WindowServantSP
#endregion
PrecyOcg precy;
public void launch(string playerDek, string aiDeck, string aiScript, bool playerGo, bool suffle, int life,bool god,int rule)
{
if (precy != null)
{
precy.dispose();
}
precy = new PrecyOcg();
precy.startAI(playerDek, aiDeck, aiScript, playerGo, suffle, life, god,rule);
RMSshow_none(InterString.Get("AI模式还在开发中,您在AI模式下遇到的BUG不会在联机的时候出现。"));
RMSshow_none(InterString.Get("本地AI模式已移除(仅支持联机对战)。"));
}
public override void preFrameFunction()
......
This diff is collapsed.
fileFormatVersion: 2
guid: e66911d20963de546aa086d0b4dc28fb
timeCreated: 1554574266
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using UnityEngine;
using YGOSharp.OCGWrapper.Enums;
public class PrecyOcg
{
public static string HintInGame = Percy.smallYgopro.HintInGame;
public static bool godMode = false;
public Percy.smallYgopro ygopro;
static string error = "Error occurred.";
public PrecyOcg()
{
error = InterString.Get("Error occurred! @nError occurred! @nError occurred! @nError occurred! @nError occurred! @nError occurred! @nYGOPro1旧版的录像崩溃了!您可以选择使用永不崩溃的新版录像。");
ygopro = new Percy.smallYgopro(receiveHandler, cardHandler, chatHandler);
ygopro.m_log = (a) => { Program.DEBUGLOG(a); };
}
public void dispose()
{
ygopro.dispose();
}
object locker = new object();
void receiveHandler(byte[] buffer)
{
byte[] bufferR = new byte[buffer.Length + 1];
bufferR[0] = 1;
buffer.CopyTo(bufferR,1);
TcpHelper.addDateJumoLine(bufferR);
}
public void startPuzzle(System.String path)
{
if (Program.I().ocgcore.isShowed == false)
{
Program.I().room.mode = 0;
Program.I().ocgcore.MasterRule = 3;
godMode = true;
prepareOcgcore();
Program.I().ocgcore.isFirst = true;
Program.I().ocgcore.returnServant = Program.I().puzzleMode;
if (!ygopro.startPuzzle(path))
{
Program.I().cardDescription.RMSshow_none(InterString.Get("游戏内部出错,请重试,文件名中不能包含中文。"));
return;
}
else
{
//Config.ClientVersion = 0x233c;
Program.I().shiftToServant(Program.I().ocgcore);
}
((CardDescription)Program.I().cardDescription).setTitle(path);
}
}
public void startAI(string playerDek, string aiDeck, string aiScript, bool playerGo, bool unrand, int life,bool god,int rule)
{
if (Program.I().ocgcore.isShowed == false)
{
Program.I().room.mode = 0;
Program.I().ocgcore.MasterRule = rule;
godMode = god;
prepareOcgcore();
Program.I().ocgcore.lpLimit = life;
Program.I().ocgcore.isFirst = playerGo;
Program.I().ocgcore.returnServant = Program.I().aiRoom;
if (!ygopro.startAI(playerDek, aiDeck, aiScript, playerGo, unrand, life, god, rule))
{
Program.I().cardDescription.RMSshow_none(InterString.Get("游戏内部出错,请重试,文件名中不能包含中文。"));
return;
}
else
{
//Config.ClientVersion = 0x233c;
Program.I().shiftToServant(Program.I().ocgcore);
}
}
}
private void prepareOcgcore()
{
Program.I().ocgcore.name_0 = Config.Get("name","一秒一喵机会");
Program.I().ocgcore.name_0_c = Program.I().ocgcore.name_0;
Program.I().ocgcore.name_1 = "Percy AI";
Program.I().ocgcore.name_1_c = "Percy AI";
Program.I().ocgcore.name_0_tag = "---";
Program.I().ocgcore.name_1_tag = "---";
Program.I().ocgcore.timeLimit = 240;
Program.I().ocgcore.lpLimit = 8000;
Program.I().ocgcore.handler = response;
Program.I().ocgcore.shiftCondition(Ocgcore.Condition.watch);
Program.I().ocgcore.InAI = true;
}
public void response(byte[] resp)
{
ygopro.response(resp);
}
Percy.CardData cardHandler(long code)
{
YGOSharp.Card card = YGOSharp.CardsManager.GetCard((int)code);
if (card==null)
{
card = new YGOSharp.Card();
}
Percy.CardData retuvalue = new Percy.CardData();
retuvalue.Alias = card.Alias;
retuvalue.Attack = card.Attack;
retuvalue.Attribute = card.Attribute;
retuvalue.Code = card.Id;
retuvalue.Defense = card.Defense;
retuvalue.Level = card.Level;
retuvalue.LScale = card.LScale;
retuvalue.Race = card.Race;
retuvalue.RScale = card.RScale;
retuvalue.Setcode = card.Setcode;
retuvalue.Type = card.Type;
retuvalue.LinkMarker = card.LinkMarker;
return retuvalue;
}
void chatHandler(string result)
{
BinaryMaster p = new BinaryMaster();
p.writer.Write((byte)YGOSharp.OCGWrapper.Enums.GameMessage.sibyl_chat);
result = result.Replace("Error Occurred.", error);
p.writer.WriteUnicode(result, result.Length + 1);
receiveHandler(p.get());
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 67bd11a2735b6054580830f6f3856e59
timeCreated: 1474540641
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -73,16 +73,8 @@ public class puzzleMode : WindowServantSP
Program.I().shiftToServant(Program.I().menu);
}
PrecyOcg precy;
public void launch(string path)
{
if (precy != null)
{
precy.dispose();
}
precy = new PrecyOcg();
precy.startPuzzle(path);
RMSshow_none(InterString.Get("残局模式已移除(仅支持联机对战)。"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment