Commented research tech button script
This commit is contained in:
@@ -1,64 +1,86 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @author Aaron Moser
|
||||
*
|
||||
* @package Assets.Scripts.Research
|
||||
*/
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
/**
|
||||
* @section DESCRIPTION
|
||||
*
|
||||
* Class contains functionality for tech button, including custom events.
|
||||
*/
|
||||
public class TechButton : Button, IPointerEnterHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Has to be set with SetResearchEvent before onMouseEnter event gets invoked.
|
||||
/// </summary>
|
||||
private NResearch.EResearchEvent eResearchEvent;
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// Public values
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of pointer/mouse enter event.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/**
|
||||
* Delegate of pointer/mouse enter event.
|
||||
*/
|
||||
public delegate void TechButtonMouseEnterHandler(object sender, NResearch.ResearchEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Public event for the pointer/mouse enter event. Gets invoked whenever a TechButton is hovered.
|
||||
/// </summary>
|
||||
/**
|
||||
* Public event for the pointer/mouse enter event. Gets invoked whenever a TechButton is hovered.
|
||||
*/
|
||||
public event TechButtonMouseEnterHandler onMouseEnter;
|
||||
|
||||
/// <summary>
|
||||
/// Delegate of pointer/mouse exit event.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
/**
|
||||
* Delegate of pointer/mouse exit event.
|
||||
*/
|
||||
public delegate void TechButtonMouseExitHandler(object sender, NResearch.ResearchEventArgs e);
|
||||
|
||||
/// <summary>
|
||||
/// Public event for the pointer/mouse exit event. Gets invoked whenever a TechButton is unhovered.
|
||||
/// </summary>
|
||||
/**
|
||||
* Public event for the pointer/mouse exit event. Gets invoked whenever a TechButton is unhovered.
|
||||
*/
|
||||
public event TechButtonMouseExitHandler onMouseExit;
|
||||
|
||||
/// <summary>
|
||||
/// Gets called from unity if mouse pointer/mouse enters TechButton gameobject.
|
||||
/// </summary>
|
||||
/// <param name="eventData"></param>
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// Private values
|
||||
|
||||
/**
|
||||
* Intern value of research event.
|
||||
* Has to be set with SetResearchEvent before onMouseEnter event gets invoked.
|
||||
*/
|
||||
private NResearch.EResearchEvent eResearchEvent;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// Public functions
|
||||
|
||||
/**
|
||||
* Gets called from unity if mouse pointer/mouse enters TechButton gameobject.
|
||||
*
|
||||
* @param eventData, data of event.
|
||||
*/
|
||||
public override void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
onMouseEnter?.Invoke(this, new NResearch.ResearchEventArgs(eResearchEvent));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets called from unity if mouse pointer/mouse exits TechButton gameobject.
|
||||
/// </summary>
|
||||
/// <param name="eventData"></param>
|
||||
/**
|
||||
* Gets called from unity if mouse pointer/mouse exits TechButton gameobject.
|
||||
*
|
||||
* @param eventData, data of event.
|
||||
*/
|
||||
public override void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
onMouseExit?.Invoke(this, new NResearch.ResearchEventArgs(NResearch.EResearchEvent.ExitTechButton));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets called from ResearchTechViewScript if pointer/mouse left a tech button.
|
||||
/// </summary>
|
||||
/// <param name="eResearchEvent"></param>
|
||||
/**
|
||||
* Gets called from ResearchTechViewScript if pointer/mouse left a tech button.
|
||||
*
|
||||
* @param eResearchEvent, research event, intern value to set to.
|
||||
*/
|
||||
public void SetResearchEvent(NResearch.EResearchEvent eResearchEvent)
|
||||
{
|
||||
this.eResearchEvent = eResearchEvent;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// Private functions
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -119,7 +119,7 @@ MonoBehaviour:
|
||||
m_MinSize: {x: 300, y: 100}
|
||||
m_MaxSize: {x: 24288, y: 16192}
|
||||
vertical: 0
|
||||
controlID: 42
|
||||
controlID: 43
|
||||
--- !u!114 &6
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@@ -144,7 +144,7 @@ MonoBehaviour:
|
||||
m_MinSize: {x: 200, y: 100}
|
||||
m_MaxSize: {x: 16192, y: 16192}
|
||||
vertical: 1
|
||||
controlID: 43
|
||||
controlID: 44
|
||||
--- !u!114 &7
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@@ -169,7 +169,7 @@ MonoBehaviour:
|
||||
m_MinSize: {x: 200, y: 50}
|
||||
m_MaxSize: {x: 16192, y: 8096}
|
||||
vertical: 0
|
||||
controlID: 44
|
||||
controlID: 45
|
||||
--- !u!114 &8
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@@ -215,8 +215,8 @@ MonoBehaviour:
|
||||
y: 0
|
||||
width: 1229
|
||||
height: 663
|
||||
m_MinSize: {x: 200, y: 200}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_MinSize: {x: 202, y: 221}
|
||||
m_MaxSize: {x: 4002, y: 4021}
|
||||
m_ActualView: {fileID: 16}
|
||||
m_Panes:
|
||||
- {fileID: 16}
|
||||
@@ -248,7 +248,7 @@ MonoBehaviour:
|
||||
m_MinSize: {x: 200, y: 50}
|
||||
m_MaxSize: {x: 16192, y: 8096}
|
||||
vertical: 0
|
||||
controlID: 92
|
||||
controlID: 93
|
||||
--- !u!114 &11
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@@ -466,7 +466,7 @@ MonoBehaviour:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs:
|
||||
m_LastClickedID: 0
|
||||
m_ExpandedIDs: fef9ffff066f0000b66f00003a7000001c710000
|
||||
m_ExpandedIDs: ecf9ffff
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@@ -1154,7 +1154,7 @@ MonoBehaviour:
|
||||
m_SkipHidden: 0
|
||||
m_SearchArea: 1
|
||||
m_Folders:
|
||||
- Assets/Scripts/Game
|
||||
- Assets/Scripts/Research/View
|
||||
m_Globs: []
|
||||
m_OriginalText:
|
||||
m_ImportLogFlags: 0
|
||||
@@ -1162,16 +1162,16 @@ MonoBehaviour:
|
||||
m_ViewMode: 1
|
||||
m_StartGridSize: 42
|
||||
m_LastFolders:
|
||||
- Assets/Scripts/Game
|
||||
- Assets/Scripts/Research/View
|
||||
m_LastFoldersGridSize: 42
|
||||
m_LastProjectPath: C:\Users\Soot\source\repos\Space4xUeberarbeitet\Space4x
|
||||
m_LockTracker:
|
||||
m_IsLocked: 0
|
||||
m_FolderTreeState:
|
||||
scrollPos: {x: 0, y: 269}
|
||||
m_SelectedIDs: a4740000
|
||||
m_LastClickedID: 29860
|
||||
m_ExpandedIDs: 00000000b6720000b8720000ba720000bc720000be720000c0720000c27200006c740000ac74000000ca9a3b
|
||||
scrollPos: {x: 0, y: 493}
|
||||
m_SelectedIDs: b6740000
|
||||
m_LastClickedID: 29878
|
||||
m_ExpandedIDs: 00000000be720000c0720000c2720000c4720000c6720000c8720000ca720000cc7200007674000000ca9a3b
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@@ -1199,7 +1199,7 @@ MonoBehaviour:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs:
|
||||
m_LastClickedID: 0
|
||||
m_ExpandedIDs: 00000000b6720000b8720000ba720000bc720000be720000c0720000c2720000
|
||||
m_ExpandedIDs: 00000000be720000c0720000c2720000c4720000c6720000c8720000ca720000cc720000
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
|
||||
Reference in New Issue
Block a user