Commit 106a1eb5 authored by 神楽坂玲奈's avatar 神楽坂玲奈

seems works

parent 5a82ef42
...@@ -17,4 +17,10 @@ public static class Utils ...@@ -17,4 +17,10 @@ public static class Utils
return Program.I().camera_back_ground_2d return Program.I().camera_back_ground_2d
.ViewportToWorldPoint(new Vector3(point.x / UIWidth(), point.y / UIHeight(), point.z)); .ViewportToWorldPoint(new Vector3(point.x / UIWidth(), point.y / UIHeight(), point.z));
} }
public static Vector3 WorldToUIPoint(Vector3 point)
{
var viewport = Program.I().camera_back_ground_2d.WorldToViewportPoint(point);
return new Vector3(viewport.x * UIWidth(), viewport.y * UIHeight(), viewport.z);
}
} }
\ No newline at end of file
...@@ -21,7 +21,7 @@ public class Menu : WindowServantSP ...@@ -21,7 +21,7 @@ public class Menu : WindowServantSP
//GameObject screen; //GameObject screen;
public override void initialize() public override void initialize()
{ {
createWindow(Program.I().new_ui_menu); SetWindow(Program.I().new_ui_menu);
UIHelper.registEvent(gameObject, "setting_", onClickSetting); UIHelper.registEvent(gameObject, "setting_", onClickSetting);
UIHelper.registEvent(gameObject, "deck_", onClickSelectDeck); UIHelper.registEvent(gameObject, "deck_", onClickSelectDeck);
UIHelper.registEvent(gameObject, "online_", onClickOnline); UIHelper.registEvent(gameObject, "online_", onClickOnline);
......
using UnityEngine; using DG.Tweening;
using UnityEngine;
public class gameButton : OCGobject public class gameButton : OCGobject
{ {
...@@ -35,9 +36,7 @@ public class gameButton : OCGobject ...@@ -35,9 +36,7 @@ public class gameButton : OCGobject
gameObject.GetComponent<iconSetForButton>().setTexture(type); gameObject.GetComponent<iconSetForButton>().setTexture(type);
gameObject.GetComponent<iconSetForButton>().setText(hint); gameObject.GetComponent<iconSetForButton>().setText(hint);
gameObject.transform.localScale = Vector3.zero; gameObject.transform.localScale = Vector3.zero;
iTween.ScaleTo(gameObject, gameObject.transform.DOScale(Vector3.one * 0.7f, 0.2f);
new Vector3(0.7f * Screen.height / 700f, 0.7f * Screen.height / 700f, 0.7f * Screen.height / 700f),
0.2f);
} }
gameObject.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(v); gameObject.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(v);
......
...@@ -292,7 +292,7 @@ public class gameCard : OCGobject ...@@ -292,7 +292,7 @@ public class gameCard : OCGobject
{ {
var screenposition = var screenposition =
Program.I().main_camera.WorldToScreenPoint(gameObject_face.transform.position + Program.I().main_camera.WorldToScreenPoint(gameObject_face.transform.position +
new Vector3(0, 1f * 2.4f, 1.732f * 2.4f)); new Vector3(0, 1f * 2.4f, 1.732f * 2.4f));
var worldposition = var worldposition =
Camera.main.ScreenToWorldPoint(new Vector3(screenposition.x, screenposition.y, screenposition.z - 5)); Camera.main.ScreenToWorldPoint(new Vector3(screenposition.x, screenposition.y, screenposition.z - 5));
obj_number.transform.position = worldposition; obj_number.transform.position = worldposition;
...@@ -606,10 +606,10 @@ public class gameCard : OCGobject ...@@ -606,10 +606,10 @@ public class gameCard : OCGobject
vector_of_begin = gameObject_face.transform.position + new Vector3(0, 0, 2); vector_of_begin = gameObject_face.transform.position + new Vector3(0, 0, 2);
else else
vector_of_begin = gameObject_face.transform.position + new Vector3(0, 0, 1.5f); vector_of_begin = gameObject_face.transform.position + new Vector3(0, 0, 1.5f);
vector_of_begin = Program.I().main_camera.WorldToScreenPoint(vector_of_begin); vector_of_begin = Utils.WorldToUIPoint(vector_of_begin);
for (var i = 0; i < buttons.Count; i++) for (var i = 0; i < buttons.Count; i++)
buttons[i].show(vector_of_begin + i * new Vector3(0, 65f * 0.7f * Screen.height / 700f) + buttons[i].show(vector_of_begin + i * new Vector3(0, 65f * 0.7f) +
new Vector3(0, 35f * 0.7f * Screen.height / 700f)); new Vector3(0, 35f * 0.7f));
} }
else else
{ {
...@@ -617,10 +617,10 @@ public class gameCard : OCGobject ...@@ -617,10 +617,10 @@ public class gameCard : OCGobject
var vector_of_begin = Vector3.zero; var vector_of_begin = Vector3.zero;
var l = 0.5f * game_object_verticle_drawing.transform.localScale.y * (h - 0.5f); var l = 0.5f * game_object_verticle_drawing.transform.localScale.y * (h - 0.5f);
vector_of_begin = game_object_verticle_drawing.transform.position + new Vector3(0, l, l * 1.732f); vector_of_begin = game_object_verticle_drawing.transform.position + new Vector3(0, l, l * 1.732f);
vector_of_begin = Program.I().main_camera.WorldToScreenPoint(vector_of_begin); vector_of_begin = Utils.WorldToUIPoint(vector_of_begin);
for (var i = 0; i < buttons.Count; i++) for (var i = 0; i < buttons.Count; i++)
buttons[i].show(vector_of_begin + i * new Vector3(0, 65f * 0.7f * Screen.height / 700f) + buttons[i].show(vector_of_begin + i * new Vector3(0, 65f * 0.7f) +
new Vector3(0, 35f * 0.7f * Screen.height / 700f)); new Vector3(0, 35f * 0.7f));
} }
} }
} }
...@@ -657,7 +657,7 @@ public class gameCard : OCGobject ...@@ -657,7 +657,7 @@ public class gameCard : OCGobject
var overlayed_cards = Program.I().ocgcore.GCS_cardGetOverlayElements(this); var overlayed_cards = Program.I().ocgcore.GCS_cardGetOverlayElements(this);
var screen = Program.I().main_camera.WorldToScreenPoint(gameObject.transform.position); var screen = Program.I().main_camera.WorldToScreenPoint(gameObject.transform.position);
screen.z = 0; screen.z = 0;
var k = Screen.height / 700f;
for (var x = 0; x < overlayed_cards.Count; x++) for (var x = 0; x < overlayed_cards.Count; x++)
if (overlayed_cards[x].isShowed == false) if (overlayed_cards[x].isShowed == false)
{ {
...@@ -665,7 +665,7 @@ public class gameCard : OCGobject ...@@ -665,7 +665,7 @@ public class gameCard : OCGobject
if (Program.getVerticalTransparency() < 0.5f) pianyi = 90f; if (Program.getVerticalTransparency() < 0.5f) pianyi = 90f;
var screen_vector_to_move = screen + var screen_vector_to_move = screen +
new Vector3( new Vector3(
pianyi * k + 60f * k * (overlayed_cards.Count - pianyi + 60f * (overlayed_cards.Count -
overlayed_cards[x].p.position - 1), 0, overlayed_cards[x].p.position - 1), 0,
12f + 2f * (overlayed_cards.Count - overlayed_cards[x].p.position - 1)); 12f + 2f * (overlayed_cards.Count - overlayed_cards[x].p.position - 1));
overlayed_cards[x].flash_line_on(); overlayed_cards[x].flash_line_on();
...@@ -1294,7 +1294,8 @@ public class gameCard : OCGobject ...@@ -1294,7 +1294,8 @@ public class gameCard : OCGobject
{ {
Vector3 screen_number_pos; Vector3 screen_number_pos;
screen_number_pos = Program.I().main_camera.WorldToScreenPoint(cardHint.gameObject.transform.position + screen_number_pos = Program.I().main_camera.WorldToScreenPoint(cardHint.gameObject.transform.position +
new Vector3(-0.61f, 0.65f, 0.65f * 1.732f)); new Vector3(-0.61f, 0.65f,
0.65f * 1.732f));
screen_number_pos.z -= 2f; screen_number_pos.z -= 2f;
verticle_number.transform.position = Program.I().main_camera.ScreenToWorldPoint(screen_number_pos); verticle_number.transform.position = Program.I().main_camera.ScreenToWorldPoint(screen_number_pos);
if (game_object_verticle_Star != null) if (game_object_verticle_Star != null)
......
...@@ -520,7 +520,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -520,7 +520,7 @@ public class Ocgcore : ServantWithCardDescription
switch (condition) switch (condition)
{ {
case Condition.duel: case Condition.duel:
SetBar(Program.I().new_bar_duel, 0, 0); CreateBar(Program.I().new_bar_duel, 0, 0);
UIHelper.registEvent(toolBar, "input_", onChat); UIHelper.registEvent(toolBar, "input_", onChat);
UIHelper.registEvent(toolBar, "gg_", onDuelResultConfirmed); UIHelper.registEvent(toolBar, "gg_", onDuelResultConfirmed);
UIHelper.registEvent(toolBar, "left_", on_left); UIHelper.registEvent(toolBar, "left_", on_left);
...@@ -530,7 +530,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -530,7 +530,7 @@ public class Ocgcore : ServantWithCardDescription
UIHelper.addButtonEvent_toolShift(toolBar, "stop_", on_stop); UIHelper.addButtonEvent_toolShift(toolBar, "stop_", on_stop);
break; break;
case Condition.watch: case Condition.watch:
SetBar(Program.I().new_bar_watchDuel, 0, 0); CreateBar(Program.I().new_bar_watchDuel, 0, 0);
UIHelper.registEvent(toolBar, "input_", onChat); UIHelper.registEvent(toolBar, "input_", onChat);
UIHelper.registEvent(toolBar, "exit_", onExit); UIHelper.registEvent(toolBar, "exit_", onExit);
UIHelper.registEvent(toolBar, "left_", on_left); UIHelper.registEvent(toolBar, "left_", on_left);
...@@ -539,7 +539,7 @@ public class Ocgcore : ServantWithCardDescription ...@@ -539,7 +539,7 @@ public class Ocgcore : ServantWithCardDescription
UIHelper.addButtonEvent_toolShift(toolBar, "stop_", on_stop); UIHelper.addButtonEvent_toolShift(toolBar, "stop_", on_stop);
break; break;
case Condition.record: case Condition.record:
SetBar(Program.I().new_bar_watchRecord, 0, 0); CreateBar(Program.I().new_bar_watchRecord, 0, 0);
UIHelper.registEvent(toolBar, "home_", onHome); UIHelper.registEvent(toolBar, "home_", onHome);
UIHelper.registEvent(toolBar, "left_", on_left); UIHelper.registEvent(toolBar, "left_", on_left);
UIHelper.registEvent(toolBar, "right_", on_right); UIHelper.registEvent(toolBar, "right_", on_right);
......
...@@ -49,8 +49,6 @@ public class Program : MonoBehaviour ...@@ -49,8 +49,6 @@ public class Program : MonoBehaviour
public GameObject new_ui_setting; public GameObject new_ui_setting;
public GameObject new_bar_room; public GameObject new_bar_room;
public GameObject new_ui_searchDetailed; public GameObject new_ui_searchDetailed;
public GameObject new_bar_editDeck;
public GameObject new_bar_duel;
public GameObject new_ui_book; public GameObject new_ui_book;
[Header("其他")] [Header("其他")]
...@@ -125,7 +123,9 @@ public class Program : MonoBehaviour ...@@ -125,7 +123,9 @@ public class Program : MonoBehaviour
public GameObject mod_ocgcore_ss_link_mark; public GameObject mod_ocgcore_ss_link_mark;
public GameObject new_ui_cardOnSearchList; public GameObject new_ui_cardOnSearchList;
public GameObject new_bar_editDeck;
public GameObject new_bar_changeSide; public GameObject new_bar_changeSide;
public GameObject new_bar_duel;
public GameObject new_bar_watchDuel; public GameObject new_bar_watchDuel;
public GameObject new_bar_watchRecord; public GameObject new_bar_watchRecord;
public GameObject new_mod_cardInDeckManager; public GameObject new_mod_cardInDeckManager;
......
...@@ -33,7 +33,7 @@ public class AIRoom : WindowServantSP ...@@ -33,7 +33,7 @@ public class AIRoom : WindowServantSP
public override void initialize() public override void initialize()
{ {
suiji = InterString.Get("随机卡组"); suiji = InterString.Get("随机卡组");
createWindow(Program.I().new_ui_aiRoom); SetWindow(Program.I().new_ui_aiRoom);
superScrollView = gameObject.GetComponentInChildren<UIselectableList>(); superScrollView = gameObject.GetComponentInChildren<UIselectableList>();
superScrollView.selectedAction = onSelected; superScrollView.selectedAction = onSelected;
list_aideck = UIHelper.getByName<UIPopupList>(gameObject, "aideck_"); list_aideck = UIHelper.getByName<UIPopupList>(gameObject, "aideck_");
......
...@@ -713,10 +713,8 @@ public class Room : WindowServantSP ...@@ -713,10 +713,8 @@ public class Room : WindowServantSP
for (var i = 0; i < 4; i++) roomPlayers[i] = null; for (var i = 0; i < 4; i++) roomPlayers[i] = null;
if (gameObject != null) ES_quit(); if (gameObject != null) ES_quit();
Object.DestroyImmediate(gameObject); Object.DestroyImmediate(gameObject);
if (mode == 2) CreateWindow(mode == 2 ? Program.I().remaster_tagRoom : Program.I().remaster_room);
createWindow(Program.I().remaster_tagRoom);
else
createWindow(Program.I().remaster_room);
lazyRoom = gameObject.GetComponent<lazyRoom>(); lazyRoom = gameObject.GetComponent<lazyRoom>();
fixScreenProblem(); fixScreenProblem();
superScrollView = gameObject.GetComponentInChildren<UIselectableList>(); superScrollView = gameObject.GetComponentInChildren<UIselectableList>();
......
...@@ -26,7 +26,7 @@ public class selectDeck : WindowServantSP ...@@ -26,7 +26,7 @@ public class selectDeck : WindowServantSP
public override void initialize() public override void initialize()
{ {
createWindow(Program.I().remaster_deckManager); SetWindow(Program.I().remaster_deckManager);
deckPanel = gameObject.GetComponentInChildren<UIDeckPanel>(); deckPanel = gameObject.GetComponentInChildren<UIDeckPanel>();
UIHelper.registEvent(gameObject, "exit_", onClickExit); UIHelper.registEvent(gameObject, "exit_", onClickExit);
superScrollView = gameObject.GetComponentInChildren<UIselectableList>(); superScrollView = gameObject.GetComponentInChildren<UIselectableList>();
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using DG.Tweening;
using UnityEngine; using UnityEngine;
using UnityEngine.Assertions; using UnityEngine.Assertions;
using YGOSharp.OCGWrapper.Enums; using YGOSharp.OCGWrapper.Enums;
...@@ -118,13 +119,11 @@ public class Servant ...@@ -118,13 +119,11 @@ public class Servant
{ {
if (toolBar != null) if (toolBar != null)
{ {
var vectorOfShowedBar_Screen = new Vector3(Screen.width - RightToScreen, buttomToScreen, 0); toolBar.transform.DOMove(
iTween.MoveTo(toolBar, Program.I().camera_back_ground_2d.ScreenToWorldPoint(vectorOfShowedBar_Screen), Utils.UIToWorldPoint(new Vector3(Utils.UIWidth() - RightToScreen, buttomToScreen, 0)),
0.6f); 0.6f);
toolBar.transform.localScale =
new Vector3(Screen.height / 700f, Screen.height / 700f, Screen.height / 700f);
var items = toolBar.GetComponentsInChildren<toolShift>(); var items = toolBar.GetComponentsInChildren<toolShift>();
for (var i = 0; i < items.Length; i++) items[i].enabled = true; foreach (var t in items) t.enabled = true;
} }
} }
...@@ -132,12 +131,11 @@ public class Servant ...@@ -132,12 +131,11 @@ public class Servant
{ {
if (toolBar != null) if (toolBar != null)
{ {
var vectorOfHidedBar_Screen = new Vector3(Screen.width - RightToScreen, -100, 0); toolBar.transform.DOMove(
iTween.MoveTo(toolBar, Program.I().camera_back_ground_2d.ScreenToWorldPoint(vectorOfHidedBar_Screen), 0.6f); Utils.UIToWorldPoint(new Vector3(Utils.UIWidth() - RightToScreen, -100, 0)),
toolBar.transform.localScale = 0.6f);
new Vector3(Screen.height / 700f, Screen.height / 700f, Screen.height / 700f);
var items = toolBar.GetComponentsInChildren<toolShift>(); var items = toolBar.GetComponentsInChildren<toolShift>();
for (var i = 0; i < items.Length; i++) items[i].enabled = false; foreach (var t in items) t.enabled = false;
} }
} }
...@@ -260,6 +258,18 @@ public class Servant ...@@ -260,6 +258,18 @@ public class Servant
fixScreenProblem(); fixScreenProblem();
} }
public void CreateBar(GameObject mod, float buttomToScreen, float RightToScreen)
{
if (toolBar != null) Object.DestroyImmediate(toolBar);
SetBar(create(
mod,
Utils.UIToWorldPoint(new Vector3(Utils.UIWidth() - RightToScreen, -100, 0)),
new Vector3(0, 0, 0),
false,
Program.I().ui_main_2d
), buttomToScreen, RightToScreen);
}
public void reShowBar(float buttomToScreen, float RightToScreen) public void reShowBar(float buttomToScreen, float RightToScreen)
{ {
this.buttomToScreen = buttomToScreen; this.buttomToScreen = buttomToScreen;
......
using UnityEngine; using DG.Tweening;
using UnityEngine;
public class WindowServant2D : Servant public class WindowServant2D : Servant
{ {
...@@ -7,7 +8,7 @@ public class WindowServant2D : Servant ...@@ -7,7 +8,7 @@ public class WindowServant2D : Servant
if (gameObject != null) if (gameObject != null)
{ {
UIHelper.clearITWeen(gameObject); UIHelper.clearITWeen(gameObject);
iTween.MoveTo(gameObject, gameObject.transform.DOMove(
Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0)), Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0)),
0.6f); 0.6f);
} }
...@@ -18,8 +19,9 @@ public class WindowServant2D : Servant ...@@ -18,8 +19,9 @@ public class WindowServant2D : Servant
if (gameObject != null) if (gameObject != null)
{ {
UIHelper.clearITWeen(gameObject); UIHelper.clearITWeen(gameObject);
iTween.MoveTo(gameObject, gameObject.transform.DOMove(
Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 0)), 0.6f); Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 0)),
0.6f);
} }
} }
......
...@@ -78,7 +78,7 @@ public class WindowServantSP : Servant ...@@ -78,7 +78,7 @@ public class WindowServantSP : Servant
} }
} }
public void createWindow(GameObject mod) public void SetWindow(GameObject mod)
{ {
gameObject = mod; gameObject = mod;
UIHelper.InterGameObject(gameObject); UIHelper.InterGameObject(gameObject);
...@@ -91,6 +91,18 @@ public class WindowServantSP : Servant ...@@ -91,6 +91,18 @@ public class WindowServantSP : Servant
panelKIller.ini(); panelKIller.ini();
} }
public void CreateWindow(GameObject mod)
{
SetWindow(create
(
mod,
Vector3.zero,
Vector3.zero,
false,
Program.I().ui_windows_2d
));
}
public override void ES_quit() public override void ES_quit()
{ {
base.ES_quit(); base.ES_quit();
......
...@@ -848,7 +848,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -848,7 +848,7 @@ public class DeckManager : ServantWithCardDescription
{ {
case Condition.editDeck: case Condition.editDeck:
UIHelper.setParent(gameObjectSearch, Program.I().ui_back_ground_2d); UIHelper.setParent(gameObjectSearch, Program.I().ui_back_ground_2d);
SetBar(Program.I().new_bar_editDeck, 0, 230); CreateBar(Program.I().new_bar_editDeck, 0, 230);
UIPopupList_banlist = UIHelper.getByName<UIPopupList>(toolBar, "lfList_"); UIPopupList_banlist = UIHelper.getByName<UIPopupList>(toolBar, "lfList_");
var banlistNames = BanlistManager.getAllName(); var banlistNames = BanlistManager.getAllName();
UIPopupList_banlist.items = banlistNames; UIPopupList_banlist.items = banlistNames;
...@@ -864,7 +864,7 @@ public class DeckManager : ServantWithCardDescription ...@@ -864,7 +864,7 @@ public class DeckManager : ServantWithCardDescription
break; break;
case Condition.changeSide: case Condition.changeSide:
UIHelper.setParent(gameObjectSearch, Program.I().ui_main_2d); UIHelper.setParent(gameObjectSearch, Program.I().ui_main_2d);
SetBar(Program.I().new_bar_changeSide, 0, 230); CreateBar(Program.I().new_bar_changeSide, 0, 230);
UIPopupList_banlist = null; UIPopupList_banlist = null;
UIHelper.registEvent(toolBar, "rand_", rand); UIHelper.registEvent(toolBar, "rand_", rand);
UIHelper.registEvent(toolBar, "sort_", sort); UIHelper.registEvent(toolBar, "sort_", sort);
......
...@@ -13,7 +13,7 @@ public class puzzleMode : WindowServantSP ...@@ -13,7 +13,7 @@ public class puzzleMode : WindowServantSP
public override void initialize() public override void initialize()
{ {
createWindow(Program.I().remaster_puzzleManager); SetWindow(Program.I().remaster_puzzleManager);
UIHelper.registEvent(gameObject, "exit_", onClickExit); UIHelper.registEvent(gameObject, "exit_", onClickExit);
superScrollView = gameObject.GetComponentInChildren<UIselectableList>(); superScrollView = gameObject.GetComponentInChildren<UIselectableList>();
superScrollView.selectedAction = onSelected; superScrollView.selectedAction = onSelected;
......
...@@ -19,7 +19,7 @@ public class selectReplay : WindowServantSP ...@@ -19,7 +19,7 @@ public class selectReplay : WindowServantSP
public override void initialize() public override void initialize()
{ {
createWindow(Program.I().remaster_replayManager); SetWindow(Program.I().remaster_replayManager);
UIHelper.registEvent(gameObject, "exit_", onClickExit); UIHelper.registEvent(gameObject, "exit_", onClickExit);
superScrollView = gameObject.GetComponentInChildren<UIselectableList>(); superScrollView = gameObject.GetComponentInChildren<UIselectableList>();
superScrollView.selectedAction = onSelected; superScrollView.selectedAction = onSelected;
......
...@@ -18,7 +18,7 @@ public class SelectServer : WindowServantSP ...@@ -18,7 +18,7 @@ public class SelectServer : WindowServantSP
public override void initialize() public override void initialize()
{ {
createWindow(Program.I().new_ui_selectServer); SetWindow(Program.I().new_ui_selectServer);
UIHelper.registEvent(gameObject, "exit_", onClickExit); UIHelper.registEvent(gameObject, "exit_", onClickExit);
UIHelper.registEvent(gameObject, "face_", onClickFace); UIHelper.registEvent(gameObject, "face_", onClickFace);
UIHelper.registEvent(gameObject, "join_", onClickJoin); UIHelper.registEvent(gameObject, "join_", onClickJoin);
......
This diff is collapsed.
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