2018年10月10日 星期三

For Third-party integration tool

1. Implement your converter class from class "IIntegrationToolConverter".If your tool is InControl, you can refer to it here.(note:The file name must be the same as the category name "IntegrationToolConverter_InControl")

2. Assign this instance to the specified field.

3. If you use InControl, you must put this game object in the scene.

For InControl

///---------------------------
/// Intelligent Menu for uGUI
/// 2017 - 2018
///---------------------------

using InControl;

namespace UnityEngine.UI.Menu
{
 public class IntegrationToolConverter_InControl : IIntegrationToolConverter
 {
  /// <summary>
  /// Get the value of the specified axis.
  /// </summary>
  
  public override float GetAxis (EasyAxis axis, EPlayer player)
  {
   InputDevice inputDevice = GetInputDevice (player);

   switch (axis)
   {
   case EasyAxis.DPadX : return inputDevice.DPadX;
   case EasyAxis.DPadY : return inputDevice.DPadY;
   case EasyAxis.LeftStickX : return inputDevice.LeftStickX;
   case EasyAxis.LeftStickY : return inputDevice.LeftStickY;
   case EasyAxis.RightStickX : return inputDevice.RightStickX;
   case EasyAxis.RightStickY : return inputDevice.RightStickY;
   }

   return 0;

   //return EasyInput.GetAxis (axis, player);
  }
  
  /// <summary>
  /// Returns true during the frame the user starts pressing down the key.
  /// </summary>
  
  public override float GetAxis (EasyKeyCode key, EPlayer player)
  {
   InputControl inputControl = GetInputControl (GetInputDevice (player), key);

   if (inputControl != null)
   {
    return inputControl;
   }

   return 0;
  }
  
  /// <summary>
  /// Returns true during the frame the user starts pressing down the key.
  /// </summary>
  
  public override bool GetKeyDown (EasyKeyCode key, EPlayer player)
  {
   InputControl inputControl = GetInputControl (GetInputDevice (player), key);
   
   if (inputControl != null)
   {
    return inputControl.WasPressed;
   }
   
   return false;
  }
  
  /// <summary>
  /// Returns true during the frame the user releases the key.
  /// </summary>
  
  public override bool GetKeyUp (EasyKeyCode key, EPlayer player)
  {
   InputControl inputControl = GetInputControl (GetInputDevice (player), key);
   
   if (inputControl != null)
   {
    return inputControl.WasReleased;
   }
   
   return false;
  }

  InputDevice GetInputDevice (EPlayer player)
  {
   InputDevice inputDevice = null;
   
   if (player == EPlayer.Anyone)
   {
    inputDevice = InControl.InputManager.ActiveDevice;
   }
   else
   {
    int playerNumber = (int)player;
    
    inputDevice = (InControl.InputManager.Devices.Count > playerNumber) ? InControl.InputManager.Devices[playerNumber] : null;
   }
   
   return inputDevice;
  }

  InputControl GetInputControl (InputDevice inputDevice, EasyKeyCode key)
  {
   switch (key)
   {
   case EasyKeyCode.ActionRight : return inputDevice.Action2;
   case EasyKeyCode.ActionDown : return inputDevice.Action1;
   case EasyKeyCode.ActionLeft : return inputDevice.Action3;
   case EasyKeyCode.ActionUp : return inputDevice.Action4;
    
   case EasyKeyCode.ShoulderTopRight : return inputDevice.RightBumper;
   case EasyKeyCode.ShoulderTopLeft : return inputDevice.LeftBumper;
   case EasyKeyCode.ShoulderBottomRight : return inputDevice.RightTrigger;
   case EasyKeyCode.ShoulderBottomLeft : return inputDevice.LeftTrigger;
    
   case EasyKeyCode.DPadRight : return inputDevice.DPadRight;
   case EasyKeyCode.DPadDown : return inputDevice.DPadDown;
   case EasyKeyCode.DPadLeft : return inputDevice.DPadLeft;
   case EasyKeyCode.DPadUp : return inputDevice.DPadUp;
    
   case EasyKeyCode.RightStick : return inputDevice.RightStickButton;
   case EasyKeyCode.RightStickRight : return inputDevice.RightStickRight;
   case EasyKeyCode.RightStickDown : return inputDevice.RightStickDown;
   case EasyKeyCode.RightStickLeft : return inputDevice.RightStickLeft;
   case EasyKeyCode.RightStickUp : return inputDevice.RightStickUp;
    
   case EasyKeyCode.LeftStick : return inputDevice.LeftStickButton;
   case EasyKeyCode.LeftStickRight : return inputDevice.LeftStickRight;
   case EasyKeyCode.LeftStickDown : return inputDevice.LeftStickDown;
   case EasyKeyCode.LeftStickLeft : return inputDevice.LeftStickLeft;
   case EasyKeyCode.LeftStickUp : return inputDevice.LeftStickUp;
    
   //case EasyKeyCode.CenterRight : return inputDevice.GetControl (InputControlType.Options);
   //case EasyKeyCode.CenterLeft : return inputDevice.GetControl (InputControlType.Share);
   //case EasyKeyCode.System : return inputDevice.GetControl (InputControlType.Home);
   }

   return null;
  }
 }
}

Supported Gamepad

PS3 on Linux,
PS3 on Mac,
PS3 on Windows,
PS3 on Windows via MotioninJoy,
PS3 on Windows via Shenghic,

PS4 on Android,
PS4 on Linux,
PS4 on Mac,
PS4 on Mac vis Bluetooth,
PS4 on Windows,

XBox360 on Android,
XBox360 on Linux,
XBox360 on Mac,
XBox360 on Windows,

XBoxOne on Mac,
XBoxOne on Windows,
XBoxOne on XBoxOne,
(note:Bluetooth version is not supported.)

LogitechF310 on Linux,
LogitechF310 on Mac,
LogitechF310 on Windows,
LogitechF510 on Linux,
LogitechF510 on Windows,
LogitechF710 on Linux,
LogitechF710 on Mac,
LogitechF710 on Windows,
LogitechRumblePad2 on Mac,
LogitechRumblePad2 on Windows,

MogaPro on Linux,
MogaPro on Mac,
MogaPro on Windows,

SteelSeriesFree on Linux,
SteelSeriesFree on Mac,
SteelSeriesFree on Windows,

2017年12月17日 星期日

EasyInput

EasyInput


class in UnityEngine.UI.iMenu

Description

The method used is similar to Input.


Static Public Functions


GetKey Returns true while the user holds down the key.

GetKeyDown Returns true during the frame the user starts pressing down the key.

GetKeyUp Returns true during the frame the user releases the key.

GetAxis Returns the value of the axis.

GetAxisRaw Returns the value of the axis with no smoothing filtering applied.

GetQuadrant Returns the value of the quadrant.

GetQuadrantRaw Returns the value of the quadrant with no smoothing filtering applied.





Scripting

2017年5月14日 星期日

FadeAnimation

FadeAnimation


class in UnityEngine.UI.iMenu / Inherits from:IFade

Description

This component will allow you under the situation of using the Navigator components to use the AnimationClip to achieve the menu dynamic, and then place this component on the GameObject of the menu.

Variables


clipFadeIn The animation clip when the menu fade in.

clipFadeOut The animation clip when the menu fade out.


Inherited members


Public Functions



FadeIn Execute the page fade in.

FadeOut Execute the page fade out.





Scripting

IFade

IFade


class in UnityEngine.UI.iMenu

Description

Processing the dynamics of the menu.

Public Functions


FadeIn Execute the page fade in.

FadeOut Execute the page fade out.





Scripting

Navigator

Navigator


class in UnityEngine.UI.iMenu / Inherits from:INavigator

Description

This component will allow you to easily handle menu switching with a small amount of code or even without any code.

Variables


playAutomatically Does it play automatically for openinnig the first page?

pageDatas Pages of the All you want to navigate.

Public Functions


AddPageData Add a page to the navigator.

HavePageInNavigator Whether the page is already in the navigator.

RemovePageData Remove a page data from the navigator.

OpenFirstPage Open and execute the first page.

CloseActivityPages Close all active pages.

AddOnExchangeListener Add listener of the page exchange event.

AddOnExchangeFinishedListener Add listener of the page finishes exchange event.

RemoveOnExchangeListener Remove the "OnExchange" listeners.

RemoveOnExchangeFinishedListener Remove the "OnExchangeFinished" listeners.

RemoveAllOnExchangeListener Remove all "OnExchange" listeners.

RemoveAllOnExchangeFinishedListener Remove all "OnExchangeFinished" listeners.

ResetToFirstOption Reset the option index to the first enabled cell position.





Scripting