Commit eb26704b authored by SherryChaos's avatar SherryChaos

online deck

parent a803597c
......@@ -200,6 +200,11 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 248673a4dcb02924f9d75ff4836b11d0
m_Address: OnlineDeckOnSelect
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: e38330e9272b0a94a916f68bd5115c96, type: 2}
m_SchemaSet:
......
MDPro3 v1.1.4更新:
1.修复[鹰身女妖的羽毛扫]特效丢失的错误。
MDPro3 v1.1.3更新:
1.现在能设置决斗开始时是否自动加速了。
2.现在能显示已知盖卡了,设置中可以关闭。
3.新增 [超融合] [技能抽取] [无限泡影] [闪电风暴] [效果遮蒙者]特效。
4.新投稿动画:新空间侠·闪烁青苔。
4.支持[Expansions]文件夹下的[lflist.conf]与*.ypk文件根目录下的[lflist.conf]禁限卡表的读取。
5.修复SelectSum消息中,可选卡片数量为1时,点击不可选卡片会导致游戏无法继续的错误。
6.修复上版本中,更改设置中的[画面质量]导致游戏背景异常的错误。
7.修复部分情况下立绘为空白的错误。
8.修复弹窗确认卡片时,使用快捷键关闭弹窗时游戏无法继续的错误。
5.支持[Expansions]文件夹下的[lflist.conf]与*.ypk文件根目录下的[lflist.conf]禁限卡表的读取。
6.修复SelectSum消息中,可选卡片数量为1时,点击不可选卡片会导致游戏无法继续的错误。
7.修复上版本中,更改设置中的[画面质量]导致游戏背景异常的错误。
8.修复部分情况下立绘为空白的错误。
9.修复弹窗确认卡片时,使用快捷键关闭弹窗时游戏无法继续的错误。
MDPro3 v1.1.2更新:
1.现在房主能在房间中添加AI进行游戏了。
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
fileFormatVersion: 2
guid: 248673a4dcb02924f9d75ff4836b11d0
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -18,6 +18,11 @@ namespace MDPro3.YGOSharp
public List<int> Stand { get; private set; }
public List<int> Mate { get; private set; }
public const string deckPrefix = "#created by ";
public const string defaultDeckAuthor = "mdpro3";
public string author = defaultDeckAuthor;
public Deck()
{
Main = new List<int>();
......@@ -34,6 +39,25 @@ namespace MDPro3.YGOSharp
public Deck(string path)
{
string text = File.ReadAllText(path);
var d = new Deck(text, defaultDeckAuthor);
Main = d.Main;
Extra = d.Extra;
Side = d.Side;
Pickup = d.Pickup;
Protector = d.Protector;
Case = d.Case;
Field = d.Field;
Grave = d.Grave;
Stand = d.Stand;
Mate = d.Mate;
author = d.author;
}
public Deck(string text, string author = defaultDeckAuthor)
{
this.author = author;
Main = new List<int>();
Extra = new List<int>();
Side = new List<int>();
......@@ -46,12 +70,22 @@ namespace MDPro3.YGOSharp
Mate = new List<int>();
try
{
string text = File.ReadAllText(path);
string st = text.Replace("\r", "");
string[] lines = st.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
int flag = -1;
foreach (string line in lines)
{
if (line.StartsWith(deckPrefix))
{
if(this.author == defaultDeckAuthor)
{
var authorString = line.Replace(deckPrefix, string.Empty);
if(OnlineDeck.StringIsIdFormat(authorString))
this.author = authorString;
}
continue;
}
if (line == "#main")
flag = 1;
else if (line == "#extra")
......@@ -77,7 +111,7 @@ namespace MDPro3.YGOSharp
int code = 0;
try
{
code = Int32.Parse(line.Replace("#", ""));
code = int.Parse(line.Replace("#", ""));
}
catch (Exception)
{
......@@ -103,19 +137,19 @@ namespace MDPro3.YGOSharp
Protector.Add(code);
break;
case 6:
Case.Add(code);
Case.Add(code);
break;
case 7:
Field.Add(code);
Field.Add(code);
break;
case 8:
Grave.Add(code);
Grave.Add(code);
break;
case 9:
Stand.Add(code);
Stand.Add(code);
break;
case 10:
Mate.Add(code);
Mate.Add(code);
break;
default:
break;
......@@ -132,11 +166,11 @@ namespace MDPro3.YGOSharp
Protector.Add(1070001);
if (Case.Count == 0)
Case.Add(1080001);
if(Field.Count == 0)
if (Field.Count == 0)
Field.Add(1090001);
if(Grave.Count == 0)
if (Grave.Count == 0)
Grave.Add(1100001);
if(Stand.Count == 0)
if (Stand.Count == 0)
Stand.Add(1110001);
if (Mate.Count == 0)
Mate.Add(1000001);
......
This diff is collapsed.
fileFormatVersion: 2
guid: 11e7163db692e534f863906ffd75e2fb
\ No newline at end of file
......@@ -100,10 +100,10 @@ namespace MDPro3
var fileName = Path.GetFileName(path);
try
{
if (path.ToLower().EndsWith(".ydk"))
if (path.ToLower().EndsWith(Program.ydkExpansion))
{
File.Copy(path, Program.deckPath + Program.slash + fileName, true);
MessageManager.Cast(InterString.Get("导入卡组「[?]」成功。", fileName.Replace(".ydk", string.Empty)));
File.Copy(path, Program.deckPath + fileName, true);
MessageManager.Cast(InterString.Get("导入卡组「[?]」成功。", fileName.Replace(Program.ydkExpansion, string.Empty)));
}
else if (path.ToLower().EndsWith(".yrp") || path.ToLower().EndsWith(".yrp3d"))
{
......@@ -139,8 +139,8 @@ namespace MDPro3
{
try
{
if (path.ToLower().EndsWith(".ydk"))
File.Move(path, Program.deckPath + Program.slash + Path.GetFileName(path));
if (path.ToLower().EndsWith(Program.ydkExpansion))
File.Move(path, Program.deckPath + Path.GetFileName(path));
if (path.ToLower().EndsWith(".yrp") || path.ToLower().EndsWith(".yrp3d"))
File.Move(path, Program.replayPath + Program.slash + Path.GetFileName(path));
if (path.ToLower().EndsWith(".ypk") || path.ToLower().EndsWith(".zip") || path.ToLower().EndsWith(".cdb") || path.ToLower().EndsWith(".conf"))
......
......@@ -10,10 +10,6 @@ namespace MDPro3
{
public class CameraManager : Manager
{
//DuelOverlay3D �����ӽ�
//DuelOverlayEffect3D ���ӽ�
//DuelOverlay2D
//DuelOverlayEffect2D OverUI
public Camera cameraMain;
public Camera camera2D;
public Camera cameraDuelOverlay3D;
......
......@@ -40,6 +40,7 @@ namespace MDPro3
public OcgCore ocgcore;
public Room room;
public EditDeck editDeck;
public OnlineDeckViewer onlineDeckViewer;
#region Initializement
......@@ -51,20 +52,21 @@ namespace MDPro3
#region State
public static bool Running = true;
public static readonly string artPath = "Picture/Art";
public static readonly string altArtPath = "Picture/Art2";
public static readonly string cardPicPath = "Picture/CardGenerated";
public static readonly string closeupPath = "Picture/Closeup";
public static readonly string dataPath = "Data";
public static readonly string localesPath = "Data/locales";
public static readonly string configPath = "Data/config.conf";
public static readonly string lflistPath = "Data/lflist.conf";
public static readonly string deckPath = "Deck";
public static readonly string expansionsPath = "Expansions";
public static readonly string puzzlePath = "Puzzle";
public static readonly string replayPath = "Replay";
public static readonly string diyPath = "Picture/DIY";
public static readonly string slash = "/";
public const string artPath = "Picture/Art";
public const string altArtPath = "Picture/Art2";
public const string cardPicPath = "Picture/CardGenerated";
public const string closeupPath = "Picture/Closeup";
public const string dataPath = "Data";
public const string localesPath = "Data/locales";
public const string configPath = "Data/config.conf";
public const string lflistPath = "Data/lflist.conf";
public const string deckPath = "Deck/";
public const string expansionsPath = "Expansions";
public const string puzzlePath = "Puzzle";
public const string replayPath = "Replay";
public const string diyPath = "Picture/DIY";
public const string slash = "/";
public const string ydkExpansion = ".ydk";
#endregion
public static Program I()
......@@ -135,6 +137,7 @@ namespace MDPro3
servants.Add(ocgcore);
servants.Add(room);
servants.Add(editDeck);
servants.Add(onlineDeckViewer);
foreach (Servant servant in servants)
servant.Initialize();
}
......
This diff is collapsed.
......@@ -343,7 +343,7 @@ namespace MDPro3
{
Program.I().room.needSide = false;
MessageManager.Cast(InterString.Get("卡片历史中为您准备了对手上一局使用过的卡。"));
Program.I().editDeck.condition = EditDeck.EditDeckCondition.ChangeSide;
Program.I().editDeck.SwitchCondition(EditDeck.Condition.ChangeSide);
ReturnTo();
return;
}
......@@ -821,8 +821,8 @@ namespace MDPro3
mate1Random = false;
deck = null;
var deckName = Config.Get("DeckInUse", "");
if (condition == Condition.Duel && inAi == false && File.Exists("Deck/" + deckName + ".ydk"))
deck = new Deck("Deck/" + deckName + ".ydk");
if (condition == Condition.Duel && inAi == false && File.Exists(Program.deckPath + deckName + Program.ydkExpansion))
deck = new Deck(Program.deckPath + deckName + Program.ydkExpansion);
UIManager.UIBlackIn(transitionTime);
yield return new WaitForSeconds(transitionTime);
......
using DG.Tweening;
using MDPro3;
using MDPro3.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.UI;
public class OnlineDeckViewer : Servant
{
public ScrollRect scrollRect;
public InputField searchDeckName;
public InputField searchAuthorName;
public ButtonSwitchForDeckPickup btnPickup;
public Text textCount;
SuperScrollView superScrollView;
OnlineDeck.OnlineDeckData[] decks;
public List<SuperScrollViewItemForOnlineDeckSelect> items = new List<SuperScrollViewItemForOnlineDeckSelect>();
public override void Initialize()
{
haveLine = true;
depth = 5;
returnServant = Program.I().selectDeck;
base.Initialize();
}
public override void ApplyShowArrangement(int preDepth)
{
base.ApplyShowArrangement(preDepth);
RefreshList();
}
public override void ApplyHideArrangement(int preDepth)
{
base.ApplyHideArrangement(preDepth);
DOTween.To(v => { }, 0, 0, transitionTime).OnComplete(() =>
{
btnPickup.OnSwitchOff();
if (superScrollView != null)
foreach (var item in superScrollView.items)
item.gameObject.GetComponent<SuperScrollViewItemForOnlineDeckSelect>().Dispose();
Clear();
});
}
void RefreshList()
{
Clear();
btnPickup.OnSwitchOff();
StartCoroutine(RefreshAsync());
}
IEnumerator RefreshAsync()
{
var task = OnlineDeck.FetchSimpleDeckList(100000, searchDeckName.text, searchAuthorName.text);
yield return new WaitUntil(() => task.IsCompleted);
if(task.Status == System.Threading.Tasks.TaskStatus.RanToCompletion)
{
decks = task.Result;
if(decks == null)
{
MessageManager.Cast(InterString.Get("网络异常,获取在线卡组列表失败。"));
yield break;
}
textCount.text = decks.Length.ToString();
Print();
}
else
MessageManager.Cast(InterString.Get("网络异常,获取在线卡组列表失败。"));
}
void Print()
{
if(superScrollView != null)
{
superScrollView.Clear();
}
var defau = 1f;
#if UNITY_ANDROID
defau = 1.5f;
#endif
var scale = Config.GetFloat("UIScale", defau);
var handle = Addressables.LoadAssetAsync<GameObject>("OnlineDeckOnSelect");
handle.Completed += (result) =>
{
superScrollView = new SuperScrollView
(
(int)Math.Floor(scrollRect.content.rect.width / (260 * scale)),
260 * scale,
240 * scale,
0,
128,
result.Result,
ItemOnListRefresh,
scrollRect
);
List<string[]> tasks = new List<string[]>();
foreach (var deck in decks)
{
if (!deck.deckName.ToLower().Contains(searchDeckName.text.ToLower()))
continue;
if (!deck.deckContributor.ToLower().Contains(searchAuthorName.text.ToLower()))
continue;
var task = new string[9]
{
deck.deckName,
deck.deckContributor,
deck.deckId,
deck.deckCase == 0 ? "1080001" : deck.deckCase.ToString(),
deck.deckCoverCard1.ToString(),
deck.deckCoverCard2.ToString(),
deck.deckCoverCard3.ToString(),
deck.deckProtector == 0 ? "1070001" : deck.deckProtector.ToString(),
deck.deckLike.ToString()
};
tasks.Add(task);
}
superScrollView.Print(tasks);
};
}
void ItemOnListRefresh(string[] task, GameObject item)
{
var handler = item.GetComponent<SuperScrollViewItemForOnlineDeckSelect>();
handler.deckName = task[0];
handler.authorName = task[1];
handler.deckId = task[2];
handler.deckCase = int.Parse(task[3]);
handler.card1 = int.Parse(task[4]);
handler.card2 = int.Parse(task[5]);
handler.card3 = int.Parse(task[6]);
handler.protector = task[7];
handler.like = int.Parse(task[8]);
handler.Refresh();
}
void Clear()
{
decks = null;
items.Clear();
}
public bool hoverOn
{
get { return m_hoverOn; }
set
{
m_hoverOn = value;
DeckHover();
}
}
private bool m_hoverOn = false;
public void DeckHover()
{
foreach (var item in items)
item.Hover(m_hoverOn);
}
public void OnSearchSubmit(string value)
{
RefreshList();
}
}
fileFormatVersion: 2
guid: 78090f67f52140a42a3f902329d74482
\ No newline at end of file
......@@ -156,8 +156,8 @@ namespace MDPro3
ChatOn(transitionTime);
Program.I().ocgcore.handler = Handler;
deckName.text = Config.Get("DeckInUse", "@ui");
if(File.Exists("Deck/" + deckName.text + ".ydk"))
deck = new Deck("Deck/" + deckName.text + ".ydk");
if(File.Exists(Program.deckPath + deckName.text + Program.ydkExpansion))
deck = new Deck(Program.deckPath + deckName.text + Program.ydkExpansion);
else
{
deck = null;
......@@ -316,9 +316,9 @@ namespace MDPro3
TcpHelper.CtosMessage_HsNotReady();
else
{
if (File.Exists("Deck/" + Config.Get("DeckInUse", "") + ".ydk"))
if (File.Exists("Deck/" + Config.Get("DeckInUse", "") + Program.ydkExpansion))
{
TcpHelper.CtosMessage_UpdateDeck(new Deck("Deck/" + Config.Get("DeckInUse", "") + ".ydk"));
TcpHelper.CtosMessage_UpdateDeck(new Deck(Program.deckPath + Config.Get("DeckInUse", "") + Program.ydkExpansion));
TcpHelper.CtosMessage_HsReady();
}
else
......
......@@ -23,6 +23,7 @@ namespace MDPro3
public List<SuperScrollViewItemForDeckSelect> items;
public ButtonSwitchForDeckPickup btnPickup;
public ToggleForDeckDelete btnDelete;
public Button btnOnline;
public enum Condition
{
......@@ -39,14 +40,17 @@ namespace MDPro3
case Condition.ForEdit:
returnServant = Program.I().menu;
depth = 1;
btnOnline.interactable = true;
break;
case Condition.ForDuel:
returnServant = Program.I().room;
depth = 3;
btnOnline.interactable = false;
break;
case Condition.ForSolo:
returnServant = Program.I().solo;
depth = 4;
btnOnline.interactable = false;
break;
}
}
......@@ -84,9 +88,9 @@ namespace MDPro3
Clear();
btnDelete.SwitchOffWithoutAction();
btnPickup.OnSwitchOff();
if (!Directory.Exists("Deck"))
Directory.CreateDirectory("Deck");
var files = Directory.GetFiles("Deck", "*.ydk");
if (!Directory.Exists(Program.deckPath))
Directory.CreateDirectory(Program.deckPath);
var files = Directory.GetFiles(Program.deckPath, "*.ydk");
List<string> fileList = files.ToList();
foreach (var file in files)
{
......@@ -124,11 +128,11 @@ namespace MDPro3
superScrollView.Clear();
items.Clear();
}
var defau = 1000f;
var defau = 1f;
#if UNITY_ANDROID
defau = 1500f;
defau = 1.5f;
#endif
var scale = float.Parse(Config.Get("UIScale", defau.ToString())) / 1000;
var scale = Config.GetFloat("UIScale", defau);
var handle = Addressables.LoadAssetAsync<GameObject>("DeckOnSelect");
handle.Completed += (result) =>
......@@ -151,11 +155,11 @@ namespace MDPro3
continue;
var task = new string[7]
{
deck.Key,
deck.Value.Case[0].ToString(),
"0", "0", "0",
deck.Value.Protector[0].ToString(),
"0"//For Delete
deck.Key,
deck.Value.Case[0].ToString(),
"0", "0", "0",
deck.Value.Protector[0].ToString(),
"0"//For Delete
};
if (deck.Value.Pickup.Count > 0)
task[2] = deck.Value.Pickup[0].ToString();
......@@ -211,18 +215,18 @@ namespace MDPro3
void DeckCheck(string deckName)
{
var path = $"Deck/{deckName}.ydk";
var path = Program.deckPath + deckName + Program.ydkExpansion;
if (File.Exists(path))
{
deckInUse = deckName;
List<string> tasks = new List<string>()
{
InterString.Get("该卡组名已存在"),
InterString.Get("该卡组名的文件已存在,是否直接覆盖创建?"),
InterString.Get("覆盖"),
InterString.Get("取消")
};
{
InterString.Get("该卡组名已存在"),
InterString.Get("该卡组名的文件已存在,是否直接覆盖创建?"),
InterString.Get("覆盖"),
InterString.Get("取消")
};
DOTween.To(v => { }, 0, 0, transitionTime + 0.1f).OnComplete(() =>
{
UIManager.ShowPopupYesOrNo(tasks, DeckFileCreateWithName, null);
......@@ -242,7 +246,7 @@ namespace MDPro3
{
try
{
var path = $"Deck/{deckName}.ydk";
var path = Program.deckPath + deckName + Program.ydkExpansion;
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
File.Create(path).Close();
......@@ -282,7 +286,7 @@ namespace MDPro3
if (item.args[6] != "0")
{
count++;
File.Delete("Deck/" + item.args[0] + ".ydk");
File.Delete(Program.deckPath + item.args[0] + Program.ydkExpansion);
MessageManager.Cast(InterString.Get("已删除卡组「[?]」", item.args[0]));
}
if (count > 0)
......@@ -301,5 +305,10 @@ namespace MDPro3
foreach (var item in items)
item.HideToggle();
}
public void OnOnlineDeckView()
{
Program.I().ShiftToServant(Program.I().onlineDeckViewer);
}
}
}
using MDPro3.UI;
using MDPro3.YGOSharp;
using Percy;
using SevenZip.Compression.LZMA;
using System;
......@@ -343,29 +344,17 @@ namespace MDPro3
var yrp = cachedYRPs[replay];
replay = replay.Replace(".yrp", "");
var value = "#created by mdpro3\r\n#main\r\n";
var value = MDPro3.YGOSharp.Deck.deckPrefix + MDPro3.YGOSharp.Deck.defaultDeckAuthor + "\r\n#main\r\n";
for (int i = 0; i < yrp.playerData[player].main.Count; i++)
value += yrp.playerData[player].main[i] + "\r\n";
value += "#extra\r\n";
for (int i = 0; i < yrp.playerData[player].extra.Count; i++)
value += yrp.playerData[player].extra[i] + "\r\n";
int count = 0;
bool saved = false;
while (!saved)
{
if (File.Exists("Deck/" + replay + "_" + yrp.playerData[player].name + "_" + count + ".ydk"))
count++;
else
{
File.WriteAllText("Deck/" + replay + "_" + yrp.playerData[player].name + "_" + count + ".ydk", value);
Config.Set("DeckInUse", replay + "_" + yrp.playerData[player].name + "_" + count);
saved = true;
}
}
var deck = new MDPro3.YGOSharp.Deck(value, MDPro3.YGOSharp.Deck.defaultDeckAuthor);
var deckName = replay +"_" + yrp.playerData[player].name;
Program.I().editDeck.SwitchCondition(EditDeck.Condition.ReplayDeck, deckName, deck);
Program.I().ShiftToServant(Program.I().editDeck);
Program.I().editDeck.returnServant = Program.I().replay;
}
}
}
......@@ -37,6 +37,8 @@ namespace MDPro3
//Hide -> ApplyHideArrangement
//Program.ShiftServant 调用show 和 hide
//show 在 isShowed为false时才执行ApplyShowArrangement
//hide 在 isShowed为true时才执行ApplyHideArrangement
public virtual void Initialize()
{
......@@ -88,7 +90,7 @@ namespace MDPro3
cg.alpha = 1f;
cg.interactable = true;
cg.blocksRaycasts = true;
if (depth <= 0 || (this == Program.I().editDeck && Program.I().editDeck.condition == EditDeck.EditDeckCondition.ChangeSide))
if (depth <= 0 || (this == Program.I().editDeck && Program.I().editDeck.condition == EditDeck.Condition.ChangeSide))
UIManager.HideExitButton(0);
else
UIManager.ShowExitButton(0);
......
......@@ -105,9 +105,9 @@ namespace MDPro3
{
string deckName = "";
deckName = newBot.command.Split(new string[] { "Deck=", " Dialog=" }, StringSplitOptions.RemoveEmptyEntries)[1].Replace("'", "").Replace(" ", "");
if(File.Exists("Data/WindBot/Decks/Ai_" + deckName + ".ydk"))
if(File.Exists("Data/WindBot/Decks/Ai_" + deckName + Program.ydkExpansion))
{
aiDeck = new Deck("Data/WindBot/Decks/Ai_" + deckName + ".ydk");
aiDeck = new Deck("Data/WindBot/Decks/Ai_" + deckName + Program.ydkExpansion);
if(aiDeck.Main.Count > 0)
newBot.main0 = aiDeck.Main[0];
}
......@@ -182,7 +182,7 @@ namespace MDPro3
if (aiCode == diyAI)
{
string selectedDeck = btnDeck.transform.GetChild(0).GetComponent<Text>().text;
if (!File.Exists("Deck/" + selectedDeck + ".ydk"))
if (!File.Exists(Program.deckPath + selectedDeck + Program.ydkExpansion))
{
MessageManager.Cast(InterString.Get("请先为AI选择有效的卡组。"));
return string.Empty;
......
......@@ -7,6 +7,7 @@ using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.Playables;
......@@ -173,5 +174,16 @@ namespace MDPro3
enumerator.MoveNext();
return enumerator.Current;
}
public static bool IsAlphaNumeric(string input)
{
Regex regex = new Regex("^[A-Za-z0-9]+$");
return regex.IsMatch(input);
}
public static bool IsLowerAlphaNumeric(string input)
{
Regex regex = new Regex("^[a-z0-9]+$");
return regex.IsMatch(input);
}
}
}
......@@ -162,12 +162,17 @@ namespace MDPro3.UI
void OnClickRight(PointerEventData eventData)
{
if (!Program.I().editDeck.deckIsFromLocalFile)
return;
if (Program.I().currentServant == Program.I().editDeck)
Program.I().editDeck.DeleteCard(this);
}
void OnBeginDrag(PointerEventData eventData)
{
if (!Program.I().editDeck.deckIsFromLocalFile)
return;
dragging = true;
transform.localScale = Vector3.one * 1.2f;
transform.SetSiblingIndex(transform.parent.childCount - 1);
......@@ -175,6 +180,9 @@ namespace MDPro3.UI
}
void OnDrag(PointerEventData eventData)
{
if (!Program.I().editDeck.deckIsFromLocalFile)
return;
var dragTarget = GetComponent<RectTransform>();
Vector3 uiPosition;
RectTransformUtility.ScreenPointToWorldPointInRectangle(
......@@ -193,6 +201,9 @@ namespace MDPro3.UI
void OnEndDrag(PointerEventData eventData)
{
if (!Program.I().editDeck.deckIsFromLocalFile)
return;
Program.I().editDeck.RefreshCardID();
dragging = false;
button.GetComponent<Image>().raycastTarget = true;
......
......@@ -9,13 +9,19 @@ namespace MDPro3.UI
public override void OnSwitchOn()
{
base.OnSwitchOn();
Program.I().selectDeck.hoverOn = true;
if(Program.I().currentServant == Program.I().selectDeck)
Program.I().selectDeck.hoverOn = true;
else
Program.I().onlineDeckViewer.hoverOn = true;
}
public override void OnSwitchOff()
{
base.OnSwitchOff();
Program.I().selectDeck.hoverOn = false;
if (Program.I().currentServant == Program.I().selectDeck)
Program.I().selectDeck.hoverOn = false;
else
Program.I().onlineDeckViewer.hoverOn = false;
}
}
}
......@@ -68,7 +68,6 @@ namespace MDPro3.UI
var servant = Program.I().currentServant;
window.DOAnchorPos(new Vector2(0f, -1100f), transitionTime).OnComplete(() =>
{
CameraManager.UIBlurMinus();
Destroy(gameObject);
servant.returnAction = null;
closeAction?.Invoke();
......
......@@ -204,7 +204,10 @@ namespace MDPro3.UI
void OnClickRight(PointerEventData eventData)
{
if (Program.I().editDeck.condition == EditDeckCondition.ChangeSide)
if (!Program.I().editDeck.deckIsFromLocalFile)
return;
if (Program.I().editDeck.condition == Condition.ChangeSide)
return;
var max = Program.I().editDeck.banlist.GetQuantity(Code);
var count = Program.I().editDeck.GetCardCount(Code);
......@@ -271,7 +274,10 @@ namespace MDPro3.UI
void OnBeginDrag(PointerEventData eventData)
{
if (Program.I().editDeck.condition == EditDeckCondition.ChangeSide)
if (!Program.I().editDeck.deckIsFromLocalFile)
return;
if (Program.I().editDeck.condition == Condition.ChangeSide)
return;
var item = Instantiate(Program.I().editDeck.itemOnTable);
......@@ -291,7 +297,10 @@ namespace MDPro3.UI
}
void OnDrag(PointerEventData eventData)
{
if (Program.I().editDeck.condition == EditDeckCondition.ChangeSide)
if (!Program.I().editDeck.deckIsFromLocalFile)
return;
if (Program.I().editDeck.condition == Condition.ChangeSide)
return;
var dragTarget = dragItem.GetComponent<RectTransform>();
......@@ -302,7 +311,10 @@ namespace MDPro3.UI
}
void OnEndDrag(PointerEventData eventData)
{
if (Program.I().editDeck.condition == EditDeckCondition.ChangeSide)
if (!Program.I().editDeck.deckIsFromLocalFile)
return;
if (Program.I().editDeck.condition == Condition.ChangeSide)
return;
var max = Program.I().editDeck.banlist.GetQuantity(Code);
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.UI;
......@@ -163,8 +162,8 @@ namespace MDPro3.UI
Config.Set("DeckInUse", deckName);
if (SelectDeck.condition == SelectDeck.Condition.ForEdit)
{
Program.I().editDeck.SwitchCondition(EditDeck.Condition.EditDeck);
Program.I().ShiftToServant(Program.I().editDeck);
Program.I().editDeck.returnServant = Program.I().selectDeck;
}
else if (SelectDeck.condition == SelectDeck.Condition.ForDuel)
{
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace MDPro3.UI
{
public class SuperScrollViewItemForOnlineDeckSelect : SuperScrollViewItem, IPointerEnterHandler, IPointerExitHandler
{
public string deckName;
public string authorName;
public string deckId;
public int deckCase;
public int card1;
public int card2;
public int card3;
public string protector;
public int like;
public Text textDeckName;
public Text textAuthorName;
public Image caseIcon;
public RawImage cardFace1;
public RawImage cardFace2;
public RawImage cardFace3;
public Text textLike;
public void Awake()
{
Program.I().onlineDeckViewer.items.Add(this);
var defau = 1000f;
#if UNITY_ANDROID
defau = 1500f;
#endif
var scale = float.Parse(Config.Get("UIScale", defau.ToString())) / 1000;
transform.localScale = Vector3.one * scale;
}
public override void Refresh()
{
StartCoroutine(RefreshAsync());
}
bool refreshed;
IEnumerator RefreshAsync()
{
refreshed = false;
textDeckName.text = deckName;
textAuthorName.text = "By " + authorName;
textLike.text = like.ToString();
var casePath = deckCase.ToString();
var load = TextureManager.LoadItemIcon(casePath);
while (load.MoveNext())
yield return null;
if (load.Current != null)
caseIcon.sprite = load.Current;
while (Program.I().selectDeck.inTransition)
yield return null;
for (int i = 0; i < transform.GetSiblingIndex(); i++)
yield return null;
Material pMat = null;
IEnumerator<Texture2D> ie = null;
if (card1 != 0)
{
ie = Program.I().texture_.LoadCardAsync(card1);
StartCoroutine(ie);
while (ie.MoveNext())
yield return null;
cardFace1.texture = ie.Current;
var mat = TextureManager.GetCardMaterial(card1);
cardFace1.material = mat;
}
else
{
if (pMat == null)
{
var im = ABLoader.LoadProtectorMaterial(protector);
while (im.MoveNext())
yield return null;
pMat = im.Current;
}
cardFace1.texture = null;
cardFace1.material = pMat;
}
if (card2 != 0)
{
ie = Program.I().texture_.LoadCardAsync(card2);
StartCoroutine(ie);
while (ie.MoveNext())
yield return null;
cardFace2.texture = ie.Current;
var mat = TextureManager.GetCardMaterial(card2);
cardFace2.material = mat;
}
else
{
if (pMat == null)
{
var im = ABLoader.LoadProtectorMaterial(protector);
while (im.MoveNext())
yield return null;
pMat = im.Current;
}
cardFace2.texture = null;
cardFace2.material = pMat;
}
if (card3 != 0)
{
ie = Program.I().texture_.LoadCardAsync(card3);
StartCoroutine(ie);
while (ie.MoveNext())
yield return null;
cardFace3.texture = ie.Current;
var mat = TextureManager.GetCardMaterial(card3);
cardFace3.material = mat;
}
else
{
if (pMat == null)
{
var im = ABLoader.LoadProtectorMaterial(protector);
while (im.MoveNext())
yield return null;
pMat = im.Current;
}
cardFace3.texture = null;
cardFace3.material = pMat;
}
refreshed = true;
}
public void Dispose()
{
StartCoroutine(DisposeAsync());
}
IEnumerator DisposeAsync()
{
while (!refreshed)
yield return null;
Destroy(gameObject);
}
public override void OnClick()
{
AudioManager.PlaySE("SE_DUEL_SELECT");
Program.I().editDeck.onlineDeckID = deckId;
Program.I().editDeck.SwitchCondition(EditDeck.Condition.OnlineDeck);
Program.I().ShiftToServant(Program.I().editDeck);
}
public void Hover(bool hover)
{
cardFace1.GetComponent<Animator>().SetBool("Hover", hover);
cardFace2.GetComponent<Animator>().SetBool("Hover", hover);
cardFace3.GetComponent<Animator>().SetBool("Hover", hover);
}
public void OnPointerEnter(PointerEventData eventData)
{
if (!Program.I().onlineDeckViewer.hoverOn)
Hover(true);
}
public void OnPointerExit(PointerEventData eventData)
{
if (!Program.I().onlineDeckViewer.hoverOn)
Hover(false);
}
}
}
fileFormatVersion: 2
guid: 1a025dcf3d0ba4446bca206300379608
\ No newline at end of file
......@@ -3,7 +3,7 @@ guid: a5feadd7b30d1444ebd541e42ed0767d
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
......@@ -20,10 +20,12 @@ TextureImporter:
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
......@@ -47,7 +49,7 @@ TextureImporter:
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteBorder: {x: 15, y: 15, z: 15, w: 15}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
......@@ -62,9 +64,10 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
......@@ -74,9 +77,10 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
......@@ -86,10 +90,11 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
- serializedVersion: 4
buildTarget: iOS
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
......@@ -98,9 +103,10 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
......@@ -110,24 +116,26 @@ TextureImporter:
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
internalID: 1537655665
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
......@@ -5052,7 +5052,6 @@
66386380 14166
39392286 14165
75064463 7111
18144507 4678
18144506 4678
39275698 14168
87639778 12900
......
......@@ -557,3 +557,24 @@ Off->Off
观战中显示已知盖卡->观战中显示已知盖卡
回放开始时自动进入加速状态->回放开始时自动进入加速状态
回放中显示已知盖卡->回放中显示已知盖卡
上传->上传
在线卡组->在线卡组
搜索作者->搜索作者
网络异常,获取在线卡组列表失败。->网络异常,获取在线卡组列表失败。
网络异常,获取在线卡组列表失败。mark1->网络异常,获取在线卡组列表失败。mark1
网络异常,获取在线卡组失败。->网络异常,获取在线卡组失败。
上传卡组[?]成功。->上传卡组[?]成功。
更新卡组[?]成功。->更新卡组[?]成功。
更新卡组「[?]」成功。->更新卡组「[?]」成功。
上传卡组「[?]」成功。->上传卡组「[?]」成功。
更新在线卡组->更新在线卡组
复制在线卡组分享码->复制在线卡组分享码
点赞->点赞
点赞卡组「[?]」成功。->点赞卡组「[?]」成功。
点赞卡组「[?]」失败:->点赞卡组「[?]」失败:
点赞过于频繁,请于 10 分钟后再试->点赞过于频繁,请于 10 分钟后再试
更新卡组「[?]」失败:->更新卡组「[?]」失败:
没有传入卡组 ID->没有传入卡组 ID
点赞卡组失败:->点赞卡组失败:
点赞卡组成功。->点赞卡组成功。
更新卡组错误->更新卡组错误
......@@ -140,7 +140,7 @@ PlayerSettings:
loadStoreDebugModeEnabled: 0
visionOSBundleVersion: 1.0
tvOSBundleVersion: 1.0
bundleVersion: 1.1.3
bundleVersion: 1.1.4
preloadedAssets:
- {fileID: 11400000, guid: 5fb02d2098f52054b89ce4a9f63ba9ee, type: 2}
- {fileID: -944628639613478452, guid: a916821eb5eea2842a69be6041bcdb82, type: 3}
......@@ -179,7 +179,7 @@ PlayerSettings:
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 0
aotOptions:
stripEngineCode: 1
stripEngineCode: 0
iPhoneStrippingLevel: 0
iPhoneScriptCallOptimization: 0
ForceInternetPermission: 0
......@@ -983,4 +983,4 @@ PlayerSettings:
hmiLoadingImage: {fileID: 0}
platformRequiresReadableAssets: 0
virtualTexturingSupportEnabled: 0
insecureHttpOption: 0
insecureHttpOption: 2
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