Commit 5ae4f260 authored by lllyasviel's avatar lllyasviel

new feature "card monitor" is finally finished!

parent 018dacf4
...@@ -35,8 +35,20 @@ public class cardPicLoader : MonoBehaviour ...@@ -35,8 +35,20 @@ public class cardPicLoader : MonoBehaviour
t.depth = 51 + l * 2; t.depth = 51 + l * 2;
} }
public Collider coli = null;
void Update() void Update()
{ {
if (coli != null)
{
if (Program.InputGetMouseButtonDown_0)
{
if (Program.pointedCollider == coli)
{
((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true);
}
}
}
if (Program.I().deckManager != null) if (Program.I().deckManager != null)
{ {
if (loaded_code != code) if (loaded_code != code)
......
...@@ -78,6 +78,7 @@ public class Book : WindowServant2D ...@@ -78,6 +78,7 @@ public class Book : WindowServant2D
public override void show() public override void show()
{ {
base.show(); base.show();
Program.I().cardDescription.shiftCardShower(true);
Program.notGo(fixScreenProblem); Program.notGo(fixScreenProblem);
fixScreenProblem(); fixScreenProblem();
realize(); realize();
......
...@@ -11,6 +11,12 @@ public class CardDescription : Servant ...@@ -11,6 +11,12 @@ public class CardDescription : Servant
UISprite lineSprite; UISprite lineSprite;
public UITextList description; public UITextList description;
GameObject line; GameObject line;
UIWidget cardShowerWidget;
UIPanel monitor;
UIDeckPanel deckPanel;
cardPicLoader[] quickCards = new cardPicLoader[300];
public override void initialize() public override void initialize()
{ {
gameObject = create gameObject = create
...@@ -26,8 +32,12 @@ public class CardDescription : Servant ...@@ -26,8 +32,12 @@ public class CardDescription : Servant
picLoader.uiTexture = UIHelper.getByName<UITexture>(gameObject, "pic_"); picLoader.uiTexture = UIHelper.getByName<UITexture>(gameObject, "pic_");
picLoader.loaded_code = -1; picLoader.loaded_code = -1;
resizer = UIHelper.getByName<UIDragResize>(gameObject, "resizer"); resizer = UIHelper.getByName<UIDragResize>(gameObject, "resizer");
resizer.onResize = onResized;
underSprite = UIHelper.getByName<UITexture>(gameObject, "under_"); underSprite = UIHelper.getByName<UITexture>(gameObject, "under_");
description = UIHelper.getByName<UITextList>(gameObject, "description_"); description = UIHelper.getByName<UITextList>(gameObject, "description_");
cardShowerWidget = UIHelper.getByName<UIWidget>(gameObject, "card_shower");
monitor = UIHelper.getByName<UIPanel>(gameObject, "monitor");
deckPanel = gameObject.GetComponentInChildren<UIDeckPanel>();
line = UIHelper.getByName(gameObject, "line"); line = UIHelper.getByName(gameObject, "line");
UIHelper.registEvent(gameObject,"pre_", onPre); UIHelper.registEvent(gameObject,"pre_", onPre);
UIHelper.registEvent(gameObject, "next_", onNext); UIHelper.registEvent(gameObject, "next_", onNext);
...@@ -43,6 +53,18 @@ public class CardDescription : Servant ...@@ -43,6 +53,18 @@ public class CardDescription : Servant
{ {
} }
read(); read();
myGraveStr = InterString.Get("我方墓地:");
myExtraStr = InterString.Get("我方额外:");
myBanishedStr = InterString.Get("我方除外:");
opGraveStr = InterString.Get("[8888FF]对方墓地:[-]");
opExtraStr = InterString.Get("[8888FF]对方额外:[-]");
opBanishedStr = InterString.Get("[8888FF]对方除外:[-]");
for (int i = 0; i < quickCards.Length; i++)
{
quickCards[i] = deckPanel.createCard();
quickCards[i].relayer(i);
}
monitor.gameObject.SetActive(false);
} }
public float width = 0; public float width = 0;
...@@ -175,10 +197,167 @@ public class CardDescription : Servant ...@@ -175,10 +197,167 @@ public class CardDescription : Servant
picLoader.defaults = def; picLoader.defaults = def;
picLoader.loaded_code = -1; picLoader.loaded_code = -1;
currentCard = card; currentCard = card;
shiftCardShower(true);
Program.go(50, () => { shiftCardShower(true); });
} }
public void setData(YGOSharp.Card card, Texture2D def, string tail = "") public void shiftCardShower(bool show)
{ {
if (show)
{
cardShowerWidget.alpha = 1f;
}
else
{
cardShowerWidget.alpha = 0f;
}
if (!show)
{
if (monitor.gameObject.activeInHierarchy == false)
{
monitor.gameObject.SetActive(true);
realizeMonitor();
}
}
else
{
monitor.gameObject.SetActive(false);
}
}
string myGraveStr = "";
string myExtraStr = "";
string myBanishedStr = "";
string opGraveStr = "";
string opExtraStr = "";
string opBanishedStr = "";
public void realizeMonitor()
{
if (monitor.gameObject.activeInHierarchy)
{
List<gameCard> myGrave = new List<gameCard>();
List<gameCard> myExtra = new List<gameCard>();
List<gameCard> myBanished = new List<gameCard>();
List<gameCard> opGrave = new List<gameCard>();
List<gameCard> opExtra = new List<gameCard>();
List<gameCard> opBanished = new List<gameCard>();
for (int i = 0; i < Program.I().ocgcore.cards.Count; i++)
{
var curCard = Program.I().ocgcore.cards[i];
int code = curCard.get_data().Id;
var gps = curCard.p;
if (code > 0)
{
if (gps.controller == 0)
{
if ((gps.location & (UInt32)game_location.LOCATION_GRAVE) > 0)
{
myGrave.Add(curCard);
}
if ((gps.location & (UInt32)game_location.LOCATION_REMOVED) > 0)
{
myBanished.Add(curCard);
}
if ((gps.location & (UInt32)game_location.LOCATION_EXTRA) > 0)
{
myExtra.Add(curCard);
}
}
else
{
if ((gps.location & (UInt32)game_location.LOCATION_GRAVE) > 0)
{
opGrave.Add(curCard);
}
if ((gps.location & (UInt32)game_location.LOCATION_REMOVED) > 0)
{
opBanished.Add(curCard);
}
if ((gps.location & (UInt32)game_location.LOCATION_EXTRA) > 0)
{
opExtra.Add(curCard);
}
}
}
}
currentHeight = 0;
currentLabelIndex = 0;
currentCardIndex = 0;
handleMonitorArea(opGrave, opGraveStr);
handleMonitorArea(opBanished, opBanishedStr);
handleMonitorArea(opExtra, opExtraStr);
handleMonitorArea(myGrave, myGraveStr);
handleMonitorArea(myBanished, myBanishedStr);
handleMonitorArea(myExtra, myExtraStr);
while (currentLabelIndex < 6)
{
deckPanel.labs[currentLabelIndex].gameObject.SetActive(false);
currentLabelIndex++;
}
while (currentCardIndex < 300)
{
quickCards[currentCardIndex].clear();
currentCardIndex++;
}
}
}
float currentHeight = 0;
int currentLabelIndex = 0;
int currentCardIndex = 0;
int eachLine = 0;
void handleMonitorArea(List<gameCard> list,string hint)
{
if (list.Count > 0)
{
deckPanel.labs[currentLabelIndex].gameObject.SetActive(true);
deckPanel.labs[currentLabelIndex].text = hint;
deckPanel.labs[currentLabelIndex].width = (int)(monitor.width - 12);
deckPanel.labs[currentLabelIndex].transform.localPosition = new Vector3(monitor.width / 2, (monitor.height - 8) / 2 - 12 - currentHeight, 0);
currentLabelIndex++;
currentHeight += 24;
float beginX = 6 + 22;
float beginY = monitor.height / 2 - currentHeight - 36;
eachLine = (int)((monitor.width - 12f) / 44f);
for (int i = 0; i < list.Count; i++)
{
var gp = UIHelper.get_hang_lie(i, eachLine);
quickCards[currentCardIndex].reCode(list[i].get_data().Id);
quickCards[currentCardIndex].transform.localPosition = new Vector3(beginX + 44 * gp.y, beginY - 60 * gp.x, 0);
currentCardIndex++;
}
int hangshu = list.Count / eachLine;
int yushu = list.Count % eachLine;
if (yushu > 0)
{
hangshu++;
}
currentHeight += 60 * hangshu;
}
}
void onResized()
{
if (monitor.gameObject.activeInHierarchy)
{
int newEach = (int)((monitor.width - 12f) / 44f);
if (newEach != eachLine)
{
eachLine = newEach;
realizeMonitor();
}
}
}
public void setData(YGOSharp.Card card, Texture2D def, string tail = "",bool force=false)
{
if (cardShowerWidget.alpha == 0&&force==false)
{
return;
}
if (card == null) if (card == null)
{ {
return; return;
......
...@@ -660,7 +660,7 @@ public class gameCard : OCGobject ...@@ -660,7 +660,7 @@ public class gameCard : OCGobject
iTween.RotateTo(gameObject, new Vector3(-30, 0, 0), 0.3f); iTween.RotateTo(gameObject, new Vector3(-30, 0, 0), 0.3f);
} }
ES_excited_unsafe_should_not_be_changed_dont_touch_this = true; ES_excited_unsafe_should_not_be_changed_dont_touch_this = true;
showMeLeft(); showMeLeft(true);
List<gameCard> overlayed_cards = Program.I().ocgcore.GCS_cardGetOverlayElements(this); List<gameCard> overlayed_cards = Program.I().ocgcore.GCS_cardGetOverlayElements(this);
Vector3 screen = Program.camera_game_main.WorldToScreenPoint(gameObject.transform.position); Vector3 screen = Program.camera_game_main.WorldToScreenPoint(gameObject.transform.position);
screen.z = 0; screen.z = 0;
...@@ -681,9 +681,9 @@ public class gameCard : OCGobject ...@@ -681,9 +681,9 @@ public class gameCard : OCGobject
} }
} }
void showMeLeft() void showMeLeft(bool force=false)
{ {
Program.I().cardDescription.setData(data, p.controller == 0 ? GameTextureManager.myBack : GameTextureManager.opBack, tails.managedString); Program.I().cardDescription.setData(data, p.controller == 0 ? GameTextureManager.myBack : GameTextureManager.opBack, tails.managedString, force);
} }
public void ES_exit_excited(bool move_to_original_place) public void ES_exit_excited(bool move_to_original_place)
......
...@@ -7174,6 +7174,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -7174,6 +7174,7 @@ public class Ocgcore : ServantWithCardDescription
Program.go(50,gameInfo.realize); Program.go(50,gameInfo.realize);
Program.notGo(Program.I().book.realize); Program.notGo(Program.I().book.realize);
Program.go(50, Program.I().book.realize); Program.go(50, Program.I().book.realize);
Program.I().cardDescription.realizeMonitor();
} }
private void animation_thunder(GameObject leftGameObject, GameObject rightGameObject) private void animation_thunder(GameObject leftGameObject, GameObject rightGameObject)
...@@ -8699,16 +8700,21 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8699,16 +8700,21 @@ public class Ocgcore : ServantWithCardDescription
bool leftExcited = false; bool leftExcited = false;
public override void ES_mouseDownEmpty() public override void ES_mouseDownEmpty()
{ {
if (gameInfo.queryHashedButton("hide_all_card") == false) if (Program.I().setting.setting.spyer.value == false)
{ if (gameInfo.queryHashedButton("hide_all_card") == false)
gameInfo.keepChain_set(true); {
leftExcited = true; gameInfo.keepChain_set(true);
} leftExcited = true;
}
base.ES_mouseDownEmpty(); base.ES_mouseDownEmpty();
} }
public override void ES_mouseUpEmpty() public override void ES_mouseUpEmpty()
{ {
if (Program.I().setting.setting.spyer.value)
{
Program.I().cardDescription.shiftCardShower(false);
}
if (gameInfo.queryHashedButton("hide_all_card") == true) if (gameInfo.queryHashedButton("hide_all_card") == true)
{ {
if (flagForTimeConfirm) if (flagForTimeConfirm)
...@@ -8720,15 +8726,16 @@ public class Ocgcore : ServantWithCardDescription ...@@ -8720,15 +8726,16 @@ public class Ocgcore : ServantWithCardDescription
} }
else else
{ {
if (leftExcited) if (Program.I().setting.setting.spyer.value == false)
{ if (leftExcited)
if (Input.GetKey(KeyCode.A)==false)
{ {
leftExcited = false; if (Input.GetKey(KeyCode.A) == false)
gameInfo.keepChain_set(false); {
} leftExcited = false;
gameInfo.keepChain_set(false);
}
} }
} }
base.ES_mouseUpEmpty(); base.ES_mouseUpEmpty();
} }
......
...@@ -30,7 +30,6 @@ public class selectDeck : WindowServantSP ...@@ -30,7 +30,6 @@ public class selectDeck : WindowServantSP
UIHelper.registEvent(gameObject, "copy_", onCopy); UIHelper.registEvent(gameObject, "copy_", onCopy);
UIHelper.registEvent(gameObject, "rename_", onRename); UIHelper.registEvent(gameObject, "rename_", onRename);
UIHelper.registEvent(gameObject, "code_", onCode); UIHelper.registEvent(gameObject, "code_", onCode);
//UIHelper.registEvent(gameObject, "search_", onSearch);
searchInput = UIHelper.getByName<UIInput>(gameObject, "search_"); searchInput = UIHelper.getByName<UIInput>(gameObject, "search_");
superScrollView.install(); superScrollView.install();
for (int i = 0; i < quickCards.Length; i++) for (int i = 0; i < quickCards.Length; i++)
......
...@@ -20,6 +20,8 @@ public class UIDeckPanel : MonoBehaviour { ...@@ -20,6 +20,8 @@ public class UIDeckPanel : MonoBehaviour {
} }
public UILabel[] labs = new UILabel[6];
public cardPicLoader createCard() public cardPicLoader createCard()
{ {
GameObject obj = (GameObject)Instantiate(cardMod); GameObject obj = (GameObject)Instantiate(cardMod);
......
fileFormatVersion: 2
guid: 5e5057eb1e1334c409f31ae1f270d6d0
timeCreated: 1495712419
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName: 20170219
assetBundleVariant: 0201
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