Commit 68c14202 authored by SherryChaos's avatar SherryChaos

add windbot to room

parent 052abcb6
MDPro3 v1.1.2更新:
1.现在能在设置中设置决斗时的加速倍率了。
2.修复了在决斗中需要输入文字时(如[抹杀之指名者]),会响应快捷键功能的错误。
3.修复由对方发动的[闪刀起动-交闪]的特效中的卡片不是检索的卡片的错误。
4.修复选择卡组界面的卡组数多到需要滚动浏览时,删除卡组会错位删除的错误。
5.增加发送消息的间隔时间,减少CPU开销。
1.现在房主能在房间中添加AI进行游戏了。
①很多AI的卡组不符合最新禁卡表,需要这类AI时,创建房间时请带上"NC"标签,本地房间需勾选[不检查卡组]。
②支持添加多个AI,房主选观战即可进行电子斗蛐蛐。
2.现在能在设置中设置决斗时的加速倍率了。
3.修复了在决斗中需要输入文字时(如[抹杀之指名者]),会响应快捷键功能的错误。
4.修复由对方发动的[闪刀起动-交闪]的特效中的卡片不是检索的卡片的错误。
5.修复选择卡组界面的卡组数多到需要滚动浏览时,删除卡组会错位删除的错误。
6.增加发送消息的间隔时间,减少CPU开销。
MDPro3 v1.1.1更新:
1.新投稿动画:琰魔龙 红莲魔·渊、龙骑士 D-终。
......
This diff is collapsed.
This diff is collapsed.
......@@ -27,6 +27,11 @@ namespace MDPro3
private static readonly Queue<Package> messageQueue = new Queue<Package>();
static Thread senderThead;
public static string joinedAddress;
public static string joinedPort;
public static string joinedPassword;
public static void InitializeSender()
{
try
......@@ -62,6 +67,9 @@ namespace MDPro3
InitializeSender();
CtosMessage_PlayerInfo(name);
CtosMessage_JoinGame(pswString, version);
joinedAddress = ipString;
joinedPort = portString;
joinedPassword = pswString;
}
catch (Exception e)
{
......
......@@ -64,6 +64,7 @@ namespace MDPro3
public void OnSolo()
{
Program.I().solo.SwitchCondition(Solo.Condition.ForSolo);
Program.I().ShiftToServant(Program.I().solo);
}
public void OnOnline()
......@@ -88,6 +89,7 @@ namespace MDPro3
}
public void OnEditDeck()
{
Program.I().selectDeck.SwitchCondition(SelectDeck.Condition.ForEdit);
Program.I().ShiftToServant(Program.I().selectDeck);
}
public void OnSetting()
......
using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
......@@ -33,6 +32,7 @@ namespace MDPro3
public Button btnToWatch;
public Button btnReady;
public Button btnStart;
public Button btnSelectAI;
public Text description;
public ScrollRect chatScroll;
......@@ -346,6 +346,31 @@ namespace MDPro3
TcpHelper.CtosMessage_Response(buffer);
}
public void OnSelectAI()
{
if (RoomIsFull())
{
MessageManager.Cast("房间已满,无法继续添加AI。");
}
else
{
Program.I().solo.SwitchCondition(Solo.Condition.ForRoom);
Program.I().ShiftToServant(Program.I().solo);
}
}
bool RoomIsFull()
{
int playerSeats = 2;
if (mode == 2)
playerSeats = 4;
for (int i = 0; i < playerSeats; i++)
if (players[i] == null)
return false;
return true;
}
public void OnChat(string content)
{
if (content == string.Empty)
......@@ -382,9 +407,7 @@ namespace MDPro3
MessageManager.Cast(InterString.Get("请先取消准备,再选择卡组。"));
return;
}
SelectDeck.state = SelectDeck.State.ForDuel;
Program.I().selectDeck.depth = 3;
Program.I().selectDeck.returnServant = this;
Program.I().selectDeck.SwitchCondition(SelectDeck.Condition.ForDuel);
Program.I().ShiftToServant(Program.I().selectDeck);
}
......@@ -722,18 +745,20 @@ namespace MDPro3
if (isHost)
{
btnStart.gameObject.SetActive(true);
roomPlayers[0].button.SetActive(true);
roomPlayers[1].button.SetActive(true);
roomPlayers[2].button.SetActive(true);
roomPlayers[3].button.SetActive(true);
roomPlayers[0].kickButton.SetActive(true);
roomPlayers[1].kickButton.SetActive(true);
roomPlayers[2].kickButton.SetActive(true);
roomPlayers[3].kickButton.SetActive(true);
btnSelectAI.gameObject.SetActive(true);
}
else
{
btnStart.gameObject.SetActive(false);
roomPlayers[0].button.SetActive(false);
roomPlayers[1].button.SetActive(false);
roomPlayers[2].button.SetActive(false);
roomPlayers[3].button.SetActive(false);
roomPlayers[0].kickButton.SetActive(false);
roomPlayers[1].kickButton.SetActive(false);
roomPlayers[2].kickButton.SetActive(false);
roomPlayers[3].kickButton.SetActive(false);
btnSelectAI.gameObject.SetActive(false);
}
if (selfType == 7)
btnReady.gameObject.SetActive(false);
......
......@@ -24,18 +24,37 @@ namespace MDPro3
public ButtonSwitchForDeckPickup btnPickup;
public ToggleForDeckDelete btnDelete;
public enum State
public enum Condition
{
ForEdit,
ForDuel,
ForSolo
}
public static State state = State.ForEdit;
public static Condition condition = Condition.ForEdit;
public void SwitchCondition(Condition condition)
{
SelectDeck.condition = condition;
switch (condition)
{
case Condition.ForEdit:
returnServant = Program.I().menu;
depth = 1;
break;
case Condition.ForDuel:
returnServant = Program.I().room;
depth = 3;
break;
case Condition.ForSolo:
returnServant = Program.I().solo;
depth = 4;
break;
}
}
public override void Initialize()
{
depth = 1;
haveLine = true;
returnServant = Program.I().menu;
SwitchCondition(Condition.ForEdit);
base.Initialize();
search.onEndEdit.AddListener(Print);
}
......@@ -57,9 +76,6 @@ namespace MDPro3
foreach (var item in superScrollView.items)
item.gameObject.GetComponent<SuperScrollViewItemForDeckSelect>().Dispose();
Clear();
depth = 1;
state = State.ForEdit;
returnServant = Program.I().menu;
});
}
......
......@@ -30,6 +30,8 @@ namespace MDPro3
public GameObject btnDeck;
public static readonly int diyAI = 6;
public static string port;
public class BotInfo
{
public string name;
......@@ -40,11 +42,34 @@ namespace MDPro3
}
private IList<BotInfo> bots = new List<BotInfo>();
public enum Condition
{
ForSolo,
ForRoom
}
public static Condition condition;
public void SwitchCondition(Condition condition)
{
Solo.condition = condition;
switch (condition)
{
case Condition.ForSolo:
returnServant = Program.I().menu;
depth = 1;
break;
case Condition.ForRoom:
returnServant = Program.I().room;
depth = 3;
break;
}
}
public override void Initialize()
{
depth = 1;
haveLine = true;
returnServant = Program.I().menu;
SwitchCondition(Condition.ForSolo);
base.Initialize();
btnDeck.transform.GetChild(0).GetComponent<Text>().text = Config.Get("DeckInUse", "@ui");
btnDeck.SetActive(false);
......@@ -146,13 +171,11 @@ namespace MDPro3
public void OnSelectAIDeck()
{
SelectDeck.state = SelectDeck.State.ForSolo;
Program.I().selectDeck.depth = 3;
Program.I().selectDeck.returnServant = this;
Program.I().selectDeck.SwitchCondition(SelectDeck.Condition.ForSolo);
Program.I().ShiftToServant(Program.I().selectDeck);
}
public void StartAI(int aiCode)
string GetWindBotCommand(int aiCode)
{
BotInfo bot = bots[aiCode];
string aiCommand = bot.command;
......@@ -162,7 +185,7 @@ namespace MDPro3
if (!File.Exists("Deck/" + selectedDeck + ".ydk"))
{
MessageManager.Cast(InterString.Get("请先为AI选择有效的卡组。"));
return;
return string.Empty;
}
aiCommand += " DeckFile=\"" + btnDeck.transform.GetChild(0).GetComponent<Text>().text + "\"";
}
......@@ -174,7 +197,24 @@ namespace MDPro3
if (command != string.Empty)
aiCommand = command;
}
Launch(aiCommand, toggleLockHand.isOn, toggleNoCheck.isOn, toggleNoShuffle.isOn);
return aiCommand;
}
public void StartAIForSolo(int aiCode)
{
string aiCommand = GetWindBotCommand(aiCode);
if(aiCommand != string.Empty)
Launch(aiCommand, toggleLockHand.isOn, toggleNoCheck.isOn, toggleNoShuffle.isOn);
}
public void StartAIForRoom(int aiCode)
{
string aiCommand = GetWindBotCommand(aiCode);
if (aiCommand != string.Empty)
{
StartWindBot(aiCommand, TcpHelper.joinedAddress, TcpHelper.joinedPort, TcpHelper.joinedPassword, toggleLockHand.isOn);
Program.I().ShiftToServant(Program.I().room);
}
}
private string GetRandomBot(string flag)
......@@ -193,21 +233,26 @@ namespace MDPro3
return "";
}
public static string port;
public void Launch(string command, bool lockHand, bool noCheck, bool noShuffle)
public void StartWindBot(string command, string ip, string port, string password, bool lockHand)
{
command = command.Replace("'", "\"");
if(lockHand)
if (lockHand)
command += " Hand=1";
command += " Host=127.0.0.1";
command += " Host=" + ip;
command += " Port=" + port;
command += " HostInfo=" + password;
(new Thread(() => { Thread.Sleep(300); WindBot.Program.Main(Tools.SplitWithPreservedQuotes(command)); })).Start();
}
public void Launch(string command, bool lockHand, bool noCheck, bool noShuffle)
{
port = inputPort.text;
if (string.IsNullOrEmpty(port) || int.Parse(port) <= 0 || int.Parse(port) > 65535)
{
port = "7911";
inputPort.text = port;
}
command += " Port=" + port;
string lp = inputLP.text;
if (string.IsNullOrEmpty(lp) /*|| lp == "0"*/)
......@@ -228,7 +273,8 @@ namespace MDPro3
Room.soloLockHand = false;
Room.fromLocalHost = false;
(new Thread(() => { Thread.Sleep(200); TcpHelper.Join("127.0.0.1", Config.Get("DuelPlayerName0", "@ui"), port, "", ""); })).Start();
(new Thread(() => { Thread.Sleep(300); WindBot.Program.Main(Tools.SplitWithPreservedQuotes(command)); })).Start();
StartWindBot(command, "127.0.0.1", port, string.Empty, lockHand);
}
}
}
......
......@@ -10,6 +10,6 @@ namespace MDPro3
public Image frame;
public Text playerName;
public GameObject readyIcon;
public GameObject button;
public GameObject kickButton;
}
}
......@@ -161,16 +161,16 @@ namespace MDPro3.UI
else
{
Config.Set("DeckInUse", deckName);
if (SelectDeck.state == SelectDeck.State.ForEdit)
if (SelectDeck.condition == SelectDeck.Condition.ForEdit)
{
Program.I().ShiftToServant(Program.I().editDeck);
Program.I().editDeck.returnServant = Program.I().selectDeck;
}
else if (SelectDeck.state == SelectDeck.State.ForDuel)
else if (SelectDeck.condition == SelectDeck.Condition.ForDuel)
{
Program.I().ShiftToServant(Program.I().room);
}
else if (SelectDeck.state == SelectDeck.State.ForSolo)
else if (SelectDeck.condition == SelectDeck.Condition.ForSolo)
{
Program.I().ShiftToServant(Program.I().solo);
Program.I().solo.btnDeck.transform.GetChild(0).GetComponent<Text>().text = deckName;
......
......@@ -35,7 +35,10 @@ namespace MDPro3.UI
StartCoroutine(enumerator);
action = () =>
{
Program.I().solo.StartAI(id);
if(Solo.condition == Solo.Condition.ForSolo)
Program.I().solo.StartAIForSolo(id);
else
Program.I().solo.StartAIForRoom(id);
};
}
......
......@@ -287,6 +287,8 @@ UI缩放->UI Scaling
请先选择有效的卡组。->Please select a valid deck
请先取消准备,再选择卡组。->Please change your deck after cancelling prepartion.
对方已离开游戏,您现在可以离开。->Your opponent left the game, you can leave now.
添加AI->Add A Bot
房间已满,无法继续添加AI。->Room is full, can not add more bots.
#EditDeck
卡组->Deck
......@@ -445,8 +447,8 @@ Off->Off
您发起了投降。->You initiated surrender.
队友发起了投降。->Your teammate initiated surrender.
请耐心等待双方玩家更换副卡组。->Please wait for both players to change their side deck.
确认卡片:[?]->Confirm Card:[?]
确认卡片:[?]张。->确认卡片:[?]张。
确认卡片:[?]->Confirm Card: [?]
确认卡片:[?]张。->Confirm Cards: [?]
#Duel Log
第[?]回合->Turn [?]
......@@ -545,7 +547,3 @@ Off->Off
祭神 莫多丽娜->Modorina the Light Retriever
当方英雄->Hero of the Yeast
MSAA 8x->MSAA 8x
SMAA High->SMAA High
Shop->Shop
攻击被无效->攻击被无效
#Boot
正在读取[?]->正在读取[?]
正在解压[?]->正在解压[?]
正在初始化->正在初始化
正在读取数据->正在读取数据
正在进入游戏->正在进入游戏
#Menu
......@@ -122,14 +124,7 @@ zh-TW->繁體中文
极致->极致
前向抗锯齿->前向抗锯齿
关闭->关闭
MSAA 2x->MSAA 2x
MSAA 4x->MSAA 4x
MSAA 8x->MSAA 8x
后期抗锯齿->后期抗锯齿
FAA->FAA
SMAA Low->SMAA Low
SMAA Medium->SMAA Medium
SMAA High->SMAA High
阴影质量->阴影质量
帧数限制->帧数限制
帧数显示->帧数显示
......@@ -205,6 +200,7 @@ UI缩放->UI缩放
决斗中的系统消息->决斗中的系统消息
观战中的系统消息->观战中的系统消息
回放中的系统消息->回放中的系统消息
加速倍率->加速倍率
自动全时点->自动全时点
决斗开始时的时点选项设置为全时点->决斗开始时的时点选项设置为全时点
自动猜拳->自动猜拳
......@@ -291,6 +287,8 @@ UI缩放->UI缩放
请先选择有效的卡组。->请先选择有效的卡组。
请先取消准备,再选择卡组。->请先取消准备,再选择卡组。
对方已离开游戏,您现在可以离开。->对方已离开游戏,您现在可以离开。
添加AI->添加AI
房间已满,无法继续添加AI。->房间已满,无法继续添加AI
#EditDeck
卡组->卡组
......@@ -446,6 +444,8 @@ Off->Off
[?],请选择效果发动。->[?],请选择效果发动。
投降->投降
您确定要投降吗?->您确定要投降吗?
您发起了投降。->您发起了投降。
队友发起了投降。->队友发起了投降。
请耐心等待双方玩家更换副卡组。->请耐心等待双方玩家更换副卡组。
确认卡片:[?]->确认卡片:[?]
确认卡片:[?]张。->确认卡片:[?]张。
......@@ -472,7 +472,7 @@ Off->Off
解放->解放
破坏->破坏
盖放->盖放
打开盖卡->打开盖卡
放置->放置
仪式召唤->仪式召唤
融合召唤->融合召唤
......@@ -547,12 +547,3 @@ Off->Off
祭神 莫多丽娜->祭神 莫多丽娜
当方英雄->当方英雄
检测到新版先行卡,请至 [游戏设置]-[扩展卡包]-[更新先行卡] 处进行更新。->检测到新版先行卡,请至 [游戏设置]-[扩展卡包]-[更新先行卡] 处进行更新。
打开盖卡->打开盖卡
攻击被无效->攻击被无效
Shop->Shop
正在初始化->正在初始化
正在读取数据->正在读取数据
ClassicRed->ClassicRed
队友发起了投降。->队友发起了投降。
加速倍率->加速倍率
......@@ -288,6 +288,8 @@ UI缩放,UI Scaling,UI缩放,UIズーム,UI 크기 조정,UI縮放,,,,,,,,,,
请先选择有效的卡组。,Please select a valid deck,"Por favor, selecciona un Deck válido primero.",使用できるデッキを選択してください。,올바른 카드덱을 먼저 선택하세요.,請先選擇有效的牌組。,,,,,,,,,,,,,,,,,,,
请先取消准备,再选择卡组。,Please change your deck after cancelling prepartion.,"Por favor, cancela la preparación antes de seleccionar un Deck.",準備完了を取り消してデッキを再選択してください,준비를 취소한 후에 카드덱을 선택하세요.,請先取消準備,再選擇牌組。,,,,,,,,,,,,,,,,,,,
对方已离开游戏,您现在可以离开。,"Your opponent left the game, you can leave now.",Tu oponente ha abandonado el juego. Ahora puedes salir.,相手はゲームを終了しました,ゲームを離脱できます。,"상대방이 게임을 떠났으므로, 이제 당신은 떠날 수 있습니다.",對方已離開遊戲,您現在可以離開。,,,,,,,,,,,,,,,,,,,
添加AI,Add A Bot,,,,,,,,,,,,,,,,,,,,,,,
房间已满,无法继续添加AI。,"Room is full, can not add more bots.",,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,
#EditDeck,,,,,,,,,,,,,,,,,,,,,,,,
卡组,Deck,Deck,デッキ,카드덱,牌組,,,,,,,,,,,,,,,,,,,
......@@ -446,8 +448,8 @@ Off,Off,Apagado,OFF,Off,Off,,,,,,,,,,,,,,,,,,,
您发起了投降。,You initiated surrender.,,,,,,,,,,,,,,,,,,,,,,,
队友发起了投降。,Your teammate initiated surrender.,,,,,,,,,,,,,,,,,,,,,,,
请耐心等待双方玩家更换副卡组。,Please wait for both players to change their side deck.,"Por favor, espera pacientemente a que ambos jugadores cambien sus Side Decks.",サイドデッキの変更を待ってください。,양측 플레이어가 부 카드덱을 교체하는 동안 기다려주세요.,請耐心等待雙方玩家更換副牌組。,,,,,,,,,,,,,,,,,,,
确认卡片:[?],Confirm Card:[?],Confirmar carta: [?],カード確認:[?],카드 확인:[?],确認卡片:[?],,,,,,,,,,,,,,,,,,,
确认卡片:[?]张。,,Confirmar cartas:[?].,カード確認:[?] 枚。,,,,,,,,,,,,,,,,,,,,,
确认卡片:[?],Confirm Card: [?],Confirmar carta: [?],カード確認:[?],카드 확인:[?],确認卡片:[?],,,,,,,,,,,,,,,,,,,
确认卡片:[?]张。,Confirm Cards: [?],Confirmar cartas:[?].,カード確認:[?] 枚。,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,
#Duel Log,,,,,,,,,,,,,,,,,,,,,,,,
第[?]回合,Turn [?],Ronda [?],ターン [?],,,,,,,,,,,,,,,,,,,,,
......
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