Commit f5512878 authored by SherryChaos's avatar SherryChaos

Mouse wheel response horizontal scrollbar

parent 4e75be13
...@@ -2002,6 +2002,7 @@ GameObject: ...@@ -2002,6 +2002,7 @@ GameObject:
- component: {fileID: 9149400914606224882} - component: {fileID: 9149400914606224882}
- component: {fileID: 9149400914606224885} - component: {fileID: 9149400914606224885}
- component: {fileID: 9149400914606224884} - component: {fileID: 9149400914606224884}
- component: {fileID: 8212829223627264905}
m_Layer: 5 m_Layer: 5
m_Name: Scroll View m_Name: Scroll View
m_TagString: Untagged m_TagString: Untagged
...@@ -2098,6 +2099,19 @@ MonoBehaviour: ...@@ -2098,6 +2099,19 @@ MonoBehaviour:
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
--- !u!114 &8212829223627264905
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9149400914606224886}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2def38340b4d0bd4495d41c98270e6fe, type: 3}
m_Name:
m_EditorClassIdentifier:
scrollSensitivity: 0.3
--- !u!1 &9149400914617502442 --- !u!1 &9149400914617502442
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -52,7 +52,7 @@ namespace MDPro3 ...@@ -52,7 +52,7 @@ namespace MDPro3
} }
catch (Exception e) catch (Exception e)
{ {
Debug.LogError("JoinError: " + e); MessageManager.messageFromSubString = "JoinError: " + e;
} }
canJoin = true; canJoin = true;
} }
......
...@@ -18,6 +18,9 @@ namespace MDPro3 ...@@ -18,6 +18,9 @@ namespace MDPro3
static List<GameObject> items = new List<GameObject>(); static List<GameObject> items = new List<GameObject>();
static readonly float transitionTime = 0.3f; static readonly float transitionTime = 0.3f;
static readonly float existTime = 3f; static readonly float existTime = 3f;
public static string messageFromSubString = string.Empty;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
...@@ -33,6 +36,15 @@ namespace MDPro3 ...@@ -33,6 +36,15 @@ namespace MDPro3
messageCard = result.Result; messageCard = result.Result;
}; };
} }
public override void PerFrameFunction()
{
base.PerFrameFunction();
if(messageFromSubString != string.Empty)
{
Cast(messageFromSubString);
messageFromSubString= string.Empty;
}
}
public void CastCard(int code) public void CastCard(int code)
{ {
......
...@@ -2604,6 +2604,7 @@ namespace MDPro3 ...@@ -2604,6 +2604,7 @@ namespace MDPro3
messagePass = false; messagePass = false;
int playerType = r.ReadByte(); int playerType = r.ReadByte();
isFirst = (playerType & 0xF) == 0; isFirst = (playerType & 0xF) == 0;
Room.coreShowing = true;
isObserver = (playerType & 0xF0) > 0; isObserver = (playerType & 0xF0) > 0;
if (r.BaseStream.Length > 17) if (r.BaseStream.Length > 17)
MasterRule = r.ReadByte(); MasterRule = r.ReadByte();
......
...@@ -63,7 +63,7 @@ namespace MDPro3 ...@@ -63,7 +63,7 @@ namespace MDPro3
public static bool fromSolo; public static bool fromSolo;
public static bool soloLockHand; public static bool soloLockHand;
public static bool fromLocalHost; public static bool fromLocalHost;
public static bool coreShowing;
public class Player public class Player
{ {
public string name = ""; public string name = "";
...@@ -150,6 +150,7 @@ namespace MDPro3 ...@@ -150,6 +150,7 @@ namespace MDPro3
public override void Show(int preDepth) public override void Show(int preDepth)
{ {
base.Show(preDepth); base.Show(preDepth);
coreShowing = false;
ChatOn(transitionTime); ChatOn(transitionTime);
Program.I().ocgcore.handler = Handler; Program.I().ocgcore.handler = Handler;
deckName.text = Config.Get("DeckInUse", "@ui"); deckName.text = Config.Get("DeckInUse", "@ui");
...@@ -405,7 +406,7 @@ namespace MDPro3 ...@@ -405,7 +406,7 @@ namespace MDPro3
} }
void AddChatItem(int player, string content) void AddChatItem(int player, string content)
{ {
if (Program.I().ocgcore.isShowed && player < 4) if (coreShowing && player < 4)
{ {
if (mode != 2) if (mode != 2)
{ {
......
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace MDPro3.UI
{
[RequireComponent(typeof(ScrollRect))]
public class HorizontalScrollbarMouseWheel : MonoBehaviour, IScrollHandler
{
Scrollbar scrollbar;
public float scrollSensitivity = 0.3f;
void Start ()
{
scrollbar = GetComponent<ScrollRect>().horizontalScrollbar;
}
public void OnScroll(PointerEventData eventData)
{
float scrollDelta = eventData.scrollDelta.y;
if (scrollDelta < 0)
scrollbar.value += scrollbar.size * scrollSensitivity;
else if (scrollDelta > 0)
scrollbar.value -= scrollbar.size * scrollSensitivity;
}
}
}
fileFormatVersion: 2
guid: 2def38340b4d0bd4495d41c98270e6fe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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