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

seems works

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