UI 迭代
This commit is contained in:
parent
f273353cb0
commit
9045e7e458
@ -1,303 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &406078842955547559
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6855144573435021451}
|
||||
- component: {fileID: 4533431376032812611}
|
||||
m_Layer: 5
|
||||
m_Name: MainMenu
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &6855144573435021451
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 406078842955547559}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 7102897325704768026}
|
||||
m_Father: {fileID: 1639091784002085428}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 282, y: -140}
|
||||
m_SizeDelta: {x: -282, y: 230}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &4533431376032812611
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 406078842955547559}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fb4f275956ba18440b061e92278f13cd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_listenControlAction: 1
|
||||
m_menuItemRoot: {fileID: 7102897325704768026}
|
||||
GroupRoot: {fileID: 5247317738185020566}
|
||||
Template: {fileID: 2502609279043838113, guid: ece591129eb9bcc48bd83ec153c98018, type: 3}
|
||||
MenuSetting:
|
||||
- Icon: {fileID: 21300000, guid: 1b52cdd34b39a8c4fa0dad6f2007e2f3, type: 3}
|
||||
Name: Game
|
||||
Description:
|
||||
SubMenus: []
|
||||
- Icon: {fileID: 21300000, guid: c300d49e84cf0fb4186c750320e50146, type: 3}
|
||||
Name: Settings
|
||||
Description:
|
||||
SubMenus: []
|
||||
HoriRollSpd: 1500
|
||||
--- !u!1 &1639091783724093882
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1639091783724093883}
|
||||
- component: {fileID: 1639091783724093861}
|
||||
- component: {fileID: 1639091783724093860}
|
||||
m_Layer: 5
|
||||
m_Name: bg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1639091783724093883
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639091783724093882}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1639091784002085428}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1639091783724093861
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639091783724093882}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &1639091783724093860
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639091783724093882}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.18823531, g: 0.20392159, b: 0.45098042, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &1639091784002085451
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1639091784002085428}
|
||||
m_Layer: 5
|
||||
m_Name: LanchUI
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1639091784002085428
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1639091784002085451}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1639091783724093883}
|
||||
- {fileID: 2355022013370943017}
|
||||
- {fileID: 6855144573435021451}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &2556464728420224707
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2355022013370943017}
|
||||
- component: {fileID: 4512092057495325491}
|
||||
m_Layer: 5
|
||||
m_Name: CommandDispatcher
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2355022013370943017
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2556464728420224707}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1639091784002085428}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4512092057495325491
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2556464728420224707}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4471d8231d16ba3469228e09d4cb3a81, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &3732356966700017678
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7102897325704768026}
|
||||
- component: {fileID: 5247317738185020566}
|
||||
- component: {fileID: 7796917812299756373}
|
||||
m_Layer: 5
|
||||
m_Name: MenuBtnGroup
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &7102897325704768026
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3732356966700017678}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6855144573435021451}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!114 &5247317738185020566
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3732356966700017678}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 3
|
||||
m_Spacing: 80
|
||||
m_ChildForceExpandWidth: 0
|
||||
m_ChildForceExpandHeight: 0
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 1
|
||||
m_ChildScaleWidth: 1
|
||||
m_ChildScaleHeight: 1
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!114 &7796917812299756373
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3732356966700017678}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 2
|
||||
m_VerticalFit: 2
|
2708
AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab
Normal file
2708
AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@ -283,7 +283,9 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: ed40f0945dba47e409627739ce124125, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_listenControlAction: 1
|
||||
PulseInvoke_Delay: 0.4
|
||||
PulseInvoke_Interval: 0.05
|
||||
m_listenControlAction: 0
|
||||
m_menuItemRoot: {fileID: 3226730524206505336}
|
||||
SubMenuItemTemplate: {fileID: 2502609279043838113, guid: 01f3c5497992f944eae9b9efa15a19c2, type: 3}
|
||||
alphaGroup: {fileID: 6355204462360987243}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public static CommandDispatcher Instance { get; private set; }
|
||||
|
||||
HashSet<MenuItemController> m_register = new HashSet<MenuItemController>();
|
||||
List<MenuItemController> m_register = new List<MenuItemController>();
|
||||
Dictionary<KeyCode, MenuItemController.EnumCommand> m_keyMapper = new Dictionary<KeyCode, MenuItemController.EnumCommand>();
|
||||
|
||||
private void Awake()
|
||||
@ -40,6 +40,8 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
public void RegistController(MenuItemController controller)
|
||||
{
|
||||
if (m_register.Contains(controller)) { return; }
|
||||
|
||||
m_register.Add(controller);
|
||||
}
|
||||
|
||||
@ -54,15 +56,21 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
if (Input.GetKeyDown(item.Key))
|
||||
{
|
||||
foreach (var controller in m_register)
|
||||
for (int i = 0; i < m_register.Count; i++)
|
||||
{
|
||||
var controller = m_register[i];
|
||||
controller.ExecuteCommand(item.Value, false);
|
||||
}
|
||||
}
|
||||
if (Input.GetKeyUp(item.Key))
|
||||
{
|
||||
foreach (var controller in m_register)
|
||||
for (int i = 0; i < m_register.Count; i++)
|
||||
{
|
||||
var controller = m_register[i];
|
||||
controller.ExecuteCommand(item.Value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
71
AxibugEmuOnline.Client/Assets/Script/UI/LaunchUI.cs
Normal file
71
AxibugEmuOnline.Client/Assets/Script/UI/LaunchUI.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class LaunchUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
RectTransform MainMenuRoot;
|
||||
[SerializeField]
|
||||
MainMenuController MainMenu;
|
||||
|
||||
Vector2 m_mainLayoutPosition;
|
||||
[SerializeField]
|
||||
Vector2 m_detailLayoutPosition;
|
||||
[SerializeField]
|
||||
float m_LayoutChangeSpeed = 10;
|
||||
|
||||
public static LaunchUI Instance { get; private set; }
|
||||
|
||||
TweenerCore<Vector2, Vector2, VectorOptions> m_layoutTween;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
m_mainLayoutPosition = MainMenuRoot.anchoredPosition;
|
||||
MainMenu.ListenControlAction = true;
|
||||
}
|
||||
|
||||
|
||||
public void ToDetailMenuLayout()
|
||||
{
|
||||
if (m_layoutTween != null)
|
||||
{
|
||||
m_layoutTween.Kill();
|
||||
m_layoutTween = null;
|
||||
}
|
||||
m_layoutTween = DOTween
|
||||
.To(
|
||||
() => MainMenuRoot.anchoredPosition,
|
||||
(x) => MainMenuRoot.anchoredPosition = x,
|
||||
m_detailLayoutPosition,
|
||||
m_LayoutChangeSpeed)
|
||||
.SetSpeedBased();
|
||||
MainMenu.ListenControlAction = false;
|
||||
MainMenu.EnterDetailState();
|
||||
}
|
||||
|
||||
public void ToMainMenuLayout()
|
||||
{
|
||||
if (m_layoutTween != null)
|
||||
{
|
||||
m_layoutTween.Kill();
|
||||
m_layoutTween = null;
|
||||
}
|
||||
m_layoutTween = DOTween.To(
|
||||
() => MainMenuRoot.anchoredPosition,
|
||||
(x) => MainMenuRoot.anchoredPosition = x,
|
||||
m_mainLayoutPosition,
|
||||
m_LayoutChangeSpeed)
|
||||
.SetSpeedBased();
|
||||
MainMenu.ListenControlAction = true;
|
||||
MainMenu.ExitDetailState();
|
||||
}
|
||||
}
|
||||
}
|
11
AxibugEmuOnline.Client/Assets/Script/UI/LaunchUI.cs.meta
Normal file
11
AxibugEmuOnline.Client/Assets/Script/UI/LaunchUI.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa6d08b067172d648a400aab72f1b4cc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -3,12 +3,14 @@ using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using static GluonGui.WorkspaceWindow.Views.Checkin.Operations.CheckinViewDeleteOperation;
|
||||
|
||||
namespace AxibugEmuOnline.Client.UI
|
||||
{
|
||||
public class MainMenu : MenuItemController
|
||||
public class MainMenuController : MenuItemController
|
||||
{
|
||||
[SerializeField]
|
||||
HorizontalLayoutGroup GroupRoot;
|
||||
@ -22,6 +24,61 @@ namespace AxibugEmuOnline.Client.UI
|
||||
private RectTransform groupRootRect => m_menuItemRoot as RectTransform;
|
||||
|
||||
private TweenerCore<Vector2, Vector2, VectorOptions> rollTween;
|
||||
private List<CanvasGroup> m_runtimeMenuUICanvas;
|
||||
private Sequence seq;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
m_runtimeMenuUICanvas = m_runtimeMenuUI.Select(menu => menu.gameObject.AddComponent<CanvasGroup>()).ToList();
|
||||
}
|
||||
|
||||
|
||||
public void EnterDetailState()
|
||||
{
|
||||
if (seq != null)
|
||||
{
|
||||
seq.Kill();
|
||||
seq = null;
|
||||
}
|
||||
|
||||
var selectItem = m_runtimeMenuUICanvas[SelectIndex];
|
||||
var hideItem = m_runtimeMenuUICanvas.Where(i => i != selectItem).ToList();
|
||||
seq = DOTween.Sequence();
|
||||
|
||||
seq.Append(
|
||||
DOTween.To(() => selectItem.alpha, (x) => selectItem.alpha = x, 1, 0.2f)
|
||||
)
|
||||
.Join(
|
||||
DOTween.To(() => hideItem[0].alpha, (x) => hideItem.ForEach(i => i.alpha = x), 0, 0.2f)
|
||||
);
|
||||
|
||||
seq.Play();
|
||||
|
||||
}
|
||||
|
||||
public void ExitDetailState()
|
||||
{
|
||||
if (seq != null)
|
||||
{
|
||||
seq.Kill();
|
||||
seq = null;
|
||||
}
|
||||
|
||||
var selectItem = m_runtimeMenuUICanvas[SelectIndex];
|
||||
var hideItem = m_runtimeMenuUICanvas.Where(i => i != selectItem).ToList();
|
||||
seq = DOTween.Sequence();
|
||||
|
||||
seq.Append(
|
||||
DOTween.To(() => selectItem.alpha, (x) => selectItem.alpha = x, 1, 0.2f)
|
||||
)
|
||||
.Join(
|
||||
DOTween.To(() => hideItem[0].alpha, (x) => hideItem.ForEach(i => i.alpha = x), 1, 0.2f)
|
||||
);
|
||||
|
||||
seq.Play();
|
||||
}
|
||||
|
||||
protected override void OnSelectMenuChanged()
|
||||
{
|
||||
@ -34,19 +91,18 @@ namespace AxibugEmuOnline.Client.UI
|
||||
|
||||
if (rollTween != null) { rollTween.Kill(); rollTween = null; }
|
||||
|
||||
rollTween = DOTween.To(
|
||||
() => groupRootRect.anchoredPosition,
|
||||
(x) => groupRootRect.anchoredPosition = x,
|
||||
targetPosition,
|
||||
HoriRollSpd)
|
||||
.SetSpeedBased().OnUpdate(() =>
|
||||
{
|
||||
for (var i = 0; i < m_runtimeMenuUI.Count; i++)
|
||||
{
|
||||
var item = m_runtimeMenuUI[i];
|
||||
item.SetSelectState(i == SelectIndex);
|
||||
}
|
||||
});
|
||||
|
||||
rollTween = DOTween.To(
|
||||
() => groupRootRect.anchoredPosition,
|
||||
(x) => groupRootRect.anchoredPosition = x,
|
||||
targetPosition,
|
||||
HoriRollSpd)
|
||||
.SetSpeedBased();
|
||||
}
|
||||
|
||||
protected override void OnCmdSelectItemLeft()
|
@ -1,11 +1,9 @@
|
||||
using Coffee.UIExtensions;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using static Codice.Client.BaseCommands.Import.Commit;
|
||||
|
||||
namespace AxibugEmuOnline.Client.UI
|
||||
{
|
||||
@ -29,6 +27,7 @@ namespace AxibugEmuOnline.Client.UI
|
||||
|
||||
public RectTransform Rect => transform as RectTransform;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_select;
|
||||
private TweenerCore<float, float, FloatOptions> progressTween;
|
||||
public float m_progress;
|
||||
@ -54,6 +53,7 @@ namespace AxibugEmuOnline.Client.UI
|
||||
|
||||
public void SetData(MenuData data)
|
||||
{
|
||||
name = data.Name;
|
||||
Icon.sprite = data.Icon;
|
||||
|
||||
if (ShadowIcon != null) ShadowIcon.sprite = data.Icon;
|
||||
@ -96,5 +96,10 @@ namespace AxibugEmuOnline.Client.UI
|
||||
public void OnEnterItem()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnExitItem()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ namespace AxibugEmuOnline.Client
|
||||
[SerializeField]
|
||||
float PulseInvoke_Interval = 0.05f;
|
||||
|
||||
[SerializeField]
|
||||
private bool m_listenControlAction;
|
||||
public bool ListenControlAction
|
||||
{
|
||||
@ -33,7 +32,7 @@ namespace AxibugEmuOnline.Client
|
||||
private PulseInvoker m_pulsInvoker_Up;
|
||||
private PulseInvoker m_pulsInvoker_Down;
|
||||
|
||||
private int m_selectIndex;
|
||||
private int m_selectIndex = -1;
|
||||
protected List<MenuItem> m_runtimeMenuUI = new List<MenuItem>();
|
||||
|
||||
public int SelectIndex
|
||||
@ -42,6 +41,7 @@ namespace AxibugEmuOnline.Client
|
||||
set
|
||||
{
|
||||
value = Mathf.Clamp(value, 0, m_runtimeMenuUI.Count - 1);
|
||||
if (m_selectIndex == value) return;
|
||||
m_selectIndex = value;
|
||||
|
||||
OnSelectMenuChanged();
|
||||
@ -62,11 +62,6 @@ namespace AxibugEmuOnline.Client
|
||||
Canvas.ForceUpdateCanvases();
|
||||
SelectIndex = 0;
|
||||
|
||||
if (m_listenControlAction)
|
||||
{
|
||||
CommandDispatcher.Instance.RegistController(this);
|
||||
}
|
||||
|
||||
m_pulsInvoker_Left = new PulseInvoker(OnCmdSelectItemLeft, PulseInvoke_Delay, PulseInvoke_Interval);
|
||||
m_pulsInvoker_Right = new PulseInvoker(OnCmdSelectItemRight, PulseInvoke_Delay, PulseInvoke_Interval);
|
||||
m_pulsInvoker_Up = new PulseInvoker(OnCmdSelectItemUp, PulseInvoke_Delay, PulseInvoke_Interval);
|
||||
@ -75,6 +70,7 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (CommandDispatcher.Instance != null)
|
||||
CommandDispatcher.Instance.UnRegistController(this);
|
||||
}
|
||||
|
||||
@ -88,8 +84,7 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
protected abstract void OnSelectMenuChanged();
|
||||
|
||||
|
||||
|
||||
MenuItem m_enteredItem = null;
|
||||
public void ExecuteCommand(EnumCommand cmd, bool cancel)
|
||||
{
|
||||
if (!cancel)
|
||||
@ -97,23 +92,52 @@ namespace AxibugEmuOnline.Client
|
||||
switch (cmd)
|
||||
{
|
||||
case EnumCommand.SelectItemLeft:
|
||||
if (m_enteredItem == null)
|
||||
{
|
||||
m_pulsInvoker_Left.SetActive();
|
||||
OnCmdSelectItemLeft(); break;
|
||||
OnCmdSelectItemLeft();
|
||||
}
|
||||
break;
|
||||
case EnumCommand.SelectItemRight:
|
||||
if (m_enteredItem == null)
|
||||
{
|
||||
m_pulsInvoker_Right.SetActive();
|
||||
OnCmdSelectItemRight(); break;
|
||||
OnCmdSelectItemRight();
|
||||
}
|
||||
break;
|
||||
case EnumCommand.SelectItemUp:
|
||||
if (m_enteredItem == null)
|
||||
{
|
||||
m_pulsInvoker_Up.SetActive();
|
||||
OnCmdSelectItemUp(); break;
|
||||
OnCmdSelectItemUp();
|
||||
}
|
||||
break;
|
||||
case EnumCommand.SelectItemDown:
|
||||
if (m_enteredItem == null)
|
||||
{
|
||||
m_pulsInvoker_Down.SetActive();
|
||||
OnCmdSelectItemDown(); break;
|
||||
OnCmdSelectItemDown();
|
||||
}
|
||||
break;
|
||||
case EnumCommand.Enter:
|
||||
var item = m_runtimeMenuUI[SelectIndex];
|
||||
OnCmdEnter(item);
|
||||
if (m_enteredItem == null)
|
||||
{
|
||||
m_enteredItem = m_runtimeMenuUI[SelectIndex];
|
||||
OnCmdEnter(m_enteredItem);
|
||||
|
||||
m_pulsInvoker_Left.DisActive();
|
||||
m_pulsInvoker_Right.DisActive();
|
||||
m_pulsInvoker_Up.DisActive();
|
||||
m_pulsInvoker_Down.DisActive();
|
||||
}
|
||||
break;
|
||||
case EnumCommand.Back:
|
||||
OnCmdBack(); break;
|
||||
if (m_enteredItem != null)
|
||||
{
|
||||
OnCmdBack(m_enteredItem);
|
||||
m_enteredItem = null;
|
||||
}
|
||||
break;
|
||||
case EnumCommand.OptionMenu:
|
||||
OnCmdOptionMenu();
|
||||
break;
|
||||
@ -145,7 +169,7 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
protected virtual void OnCmdOptionMenu() { }
|
||||
protected virtual void OnCmdEnter(MenuItem item) { item.OnEnterItem(); }
|
||||
protected virtual void OnCmdBack() { }
|
||||
protected virtual void OnCmdBack(MenuItem item) { item.OnExitItem(); }
|
||||
public enum EnumCommand
|
||||
{
|
||||
SelectItemLeft,
|
||||
|
@ -59,6 +59,20 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnCmdEnter(MenuItem item)
|
||||
{
|
||||
LaunchUI.Instance.ToDetailMenuLayout();
|
||||
item.SetSelectState(false);
|
||||
base.OnCmdEnter(item);
|
||||
}
|
||||
|
||||
protected override void OnCmdBack(MenuItem item)
|
||||
{
|
||||
LaunchUI.Instance.ToMainMenuLayout();
|
||||
item.SetSelectState(true);
|
||||
base.OnCmdBack(item);
|
||||
}
|
||||
|
||||
protected override void OnCmdSelectItemUp()
|
||||
{
|
||||
SelectIndex--;
|
||||
@ -101,6 +115,13 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
calcItemPosition();
|
||||
|
||||
for (var i = 0; i < m_runtimeMenuUI.Count; i++)
|
||||
{
|
||||
var item = m_runtimeMenuUI[i];
|
||||
bool isSelectItem = i == SelectIndex;
|
||||
item.SetSelectState(isSelectItem);
|
||||
}
|
||||
|
||||
rollTween = DOTween.To(() => 1, (x) => { }, 1, duration).OnUpdate(() =>
|
||||
{
|
||||
var tweenProgress = rollTween.position / rollTween.Duration();
|
||||
@ -109,8 +130,6 @@ namespace AxibugEmuOnline.Client
|
||||
var item = m_runtimeMenuUI[i];
|
||||
var needPos = m_itemUIPosition[i];
|
||||
item.Rect.anchoredPosition = Vector2.Lerp(item.Rect.anchoredPosition, needPos, tweenProgress);
|
||||
bool isSelectItem = i == SelectIndex;
|
||||
item.SetSelectState(isSelectItem);
|
||||
}
|
||||
}).OnComplete(() =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user