add
This commit is contained in:
72
Assets/trCRM/Scripts/ui/CLUICheckbox.cs
Normal file
72
Assets/trCRM/Scripts/ui/CLUICheckbox.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Coolape;
|
||||
|
||||
public class CLUICheckbox : CLUIElement
|
||||
{
|
||||
public bool isMultMode = true;
|
||||
object data;
|
||||
//ArrayList checkeds = new ArrayList();
|
||||
string _value = "";
|
||||
|
||||
public List<EventDelegate> onChange = new List<EventDelegate>();
|
||||
|
||||
public void init(object data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
protected void ExecuteOnChange()
|
||||
{
|
||||
if (EventDelegate.IsValid(onChange))
|
||||
{
|
||||
EventDelegate.Execute(onChange, gameObject); // modify by chenbin
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
CLPanelManager.getPanelAsy("PanelPopCheckBoxs", (Callback)onGetPanel);
|
||||
}
|
||||
void onGetPanel(params object[] obj)
|
||||
{
|
||||
CLPanelLua p = (CLPanelLua)(obj[0]);
|
||||
ArrayList orgs = new ArrayList();
|
||||
orgs.Add(data);
|
||||
orgs.Add(value);
|
||||
orgs.Add(isMultMode);
|
||||
orgs.Add((Callback)onSelectedValue);
|
||||
p.setData(orgs);
|
||||
CLPanelManager.showTopPanel(p, true, true);
|
||||
}
|
||||
|
||||
void onSelectedValue(params object[] orgs)
|
||||
{
|
||||
string val = orgs[0].ToString();
|
||||
value = val;
|
||||
}
|
||||
|
||||
public override object value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_value = value.ToString();
|
||||
ExecuteOnChange();
|
||||
}
|
||||
}
|
||||
|
||||
public override object getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public override void setValue(object obj)
|
||||
{
|
||||
value = obj;
|
||||
}
|
||||
}
|
||||
11
Assets/trCRM/Scripts/ui/CLUICheckbox.cs.meta
Normal file
11
Assets/trCRM/Scripts/ui/CLUICheckbox.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10e537da23dab4a78b272e1caed2ad0f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/trCRM/Scripts/ui/MyDragEvent4Page.cs
Normal file
33
Assets/trCRM/Scripts/ui/MyDragEvent4Page.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Coolape;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class MyDragEvent4Page : UIEventListener
|
||||
{
|
||||
public MyDragManager _dragPage;
|
||||
|
||||
public MyDragManager dragPage {
|
||||
get {
|
||||
if (_dragPage == null) {
|
||||
_dragPage = GetComponentInParent<MyDragManager> ();
|
||||
}
|
||||
return _dragPage;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPress (bool isPressed)
|
||||
{
|
||||
if (dragPage != null) {
|
||||
dragPage.OnPress (isPressed);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDrag (Vector2 delta)
|
||||
{
|
||||
if (dragPage != null) {
|
||||
dragPage.OnDrag (delta);
|
||||
dragPage.notifyDrag (delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/trCRM/Scripts/ui/MyDragEvent4Page.cs.meta
Normal file
11
Assets/trCRM/Scripts/ui/MyDragEvent4Page.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c959b935cdd44607b9e8c846bbedee7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
110
Assets/trCRM/Scripts/ui/MyDragManager.cs
Normal file
110
Assets/trCRM/Scripts/ui/MyDragManager.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Coolape;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class MyDragManager : UIEventListener
|
||||
{
|
||||
public UIDragPageContents _dragPage;
|
||||
|
||||
public UIDragPageContents dragPage {
|
||||
get {
|
||||
if (_dragPage == null) {
|
||||
UIGridPage gridpage = GetComponentInParent<UIGridPage> ();
|
||||
if (gridpage != null) {
|
||||
_dragPage = gridpage.GetComponentInParent<UIDragPageContents> ();
|
||||
}
|
||||
}
|
||||
return _dragPage;
|
||||
}
|
||||
}
|
||||
|
||||
public UIDragScrollView _dragContent;
|
||||
|
||||
public UIDragScrollView dragContent {
|
||||
get {
|
||||
if (_dragContent == null) {
|
||||
_dragContent = GetComponentInParent<UIDragScrollView> ();
|
||||
}
|
||||
return _dragContent;
|
||||
}
|
||||
}
|
||||
|
||||
// Vector2 totalDelta = Vector2.zero;
|
||||
|
||||
public void Start ()
|
||||
{
|
||||
if (dragPage != null)
|
||||
dragPage.enabled = true;
|
||||
if (dragContent != null)
|
||||
dragContent.enabled = true;
|
||||
}
|
||||
|
||||
bool canDrag = false;
|
||||
|
||||
public void OnPress (bool isPressed)
|
||||
{
|
||||
if (!NGUITools.GetActive (this))
|
||||
return;
|
||||
if (isPressed) {
|
||||
canDrag = true;
|
||||
if (dragPage != null) {
|
||||
dragPage.enabled = true;
|
||||
dragPage.OnPress (isPressed);
|
||||
}
|
||||
if (dragContent != null) {
|
||||
dragContent.enabled = true;
|
||||
dragContent.OnPress (isPressed);
|
||||
}
|
||||
} else {
|
||||
canDrag = false;
|
||||
|
||||
if (dragPage != null) {
|
||||
dragPage.enabled = true;
|
||||
dragPage.OnPress (isPressed);
|
||||
}
|
||||
if (dragContent != null) {
|
||||
dragContent.enabled = true;
|
||||
dragContent.OnPress (isPressed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyDrag (Vector2 delta)
|
||||
{
|
||||
if (!NGUITools.GetActive (this))
|
||||
return;
|
||||
if (dragPage != null && dragPage.enabled) {
|
||||
dragPage.OnDrag (delta);
|
||||
}
|
||||
if (dragContent != null && dragContent.enabled) {
|
||||
dragContent.OnDrag (delta);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDrag (Vector2 delta)
|
||||
{
|
||||
if (!NGUITools.GetActive (this))
|
||||
return;
|
||||
if (!canDrag) {
|
||||
return;
|
||||
}
|
||||
canDrag = false;
|
||||
if (Mathf.Abs (delta.x) > Mathf.Abs (delta.y)) {
|
||||
// dragPage.enabled = true;
|
||||
if (dragPage != null) {
|
||||
dragPage.enabled = true;
|
||||
dragContent.enabled = false;
|
||||
// dragPage.OnPress (true);
|
||||
// dragPage.OnDrag (delta);
|
||||
}
|
||||
} else {
|
||||
if (dragContent != null) {
|
||||
dragContent.enabled = true;
|
||||
dragPage.enabled = false;
|
||||
// dragContent.OnPress (true);
|
||||
// dragContent.OnDrag (delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/trCRM/Scripts/ui/MyDragManager.cs.meta
Normal file
11
Assets/trCRM/Scripts/ui/MyDragManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea1ee2de65dd74683b569d4604546609
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
73
Assets/trCRM/Scripts/ui/MyInputReset.cs
Normal file
73
Assets/trCRM/Scripts/ui/MyInputReset.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MyInputReset : UIEventListener
|
||||
{
|
||||
public UIInput input;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
input = GetComponentInParent<UIInput>();
|
||||
}
|
||||
if (input != null)
|
||||
{
|
||||
EventDelegate newDel = new EventDelegate();
|
||||
newDel.target = this;
|
||||
newDel.methodName = "onInputChg";
|
||||
input.onChange.Add(newDel);
|
||||
onInputChg(input.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
bool _disabled = false;
|
||||
public bool disabled
|
||||
{
|
||||
set
|
||||
{
|
||||
_disabled = value;
|
||||
if (value)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input != null)
|
||||
{
|
||||
onInputChg(input.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
get
|
||||
{
|
||||
return _disabled;
|
||||
}
|
||||
}
|
||||
|
||||
public void onInputChg(GameObject go)
|
||||
{
|
||||
if (disabled) return;
|
||||
if (string.IsNullOrEmpty(input.value))
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
if (disabled) return;
|
||||
if (input != null)
|
||||
{
|
||||
input.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
11
Assets/trCRM/Scripts/ui/MyInputReset.cs.meta
Normal file
11
Assets/trCRM/Scripts/ui/MyInputReset.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce7ce3a27703447e98bd5b91307e34c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
44
Assets/trCRM/Scripts/ui/MyUIElementRedstar.cs
Normal file
44
Assets/trCRM/Scripts/ui/MyUIElementRedstar.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MyUIElementRedstar : MonoBehaviour
|
||||
{
|
||||
public CLUIElement _element;
|
||||
CLUIElement element
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_element == null)
|
||||
{
|
||||
_element = GetComponent<CLUIElement>();
|
||||
if (_element == null)
|
||||
{
|
||||
_element = GetComponentInParent<CLUIElement>();
|
||||
|
||||
}
|
||||
}
|
||||
return _element;
|
||||
}
|
||||
}
|
||||
UILabel _label;
|
||||
UILabel label
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_label == null)
|
||||
{
|
||||
_label = GetComponent<UILabel>();
|
||||
}
|
||||
return _label;
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (label != null && element != null)
|
||||
{
|
||||
label.enabled = !element.canNull;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/trCRM/Scripts/ui/MyUIElementRedstar.cs.meta
Normal file
11
Assets/trCRM/Scripts/ui/MyUIElementRedstar.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd5e9ed3dcd9e4e4c81c8ceeeabc37bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/trCRM/Scripts/ui/MyUIPanel.cs
Normal file
11
Assets/trCRM/Scripts/ui/MyUIPanel.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Coolape;
|
||||
using XLua;
|
||||
|
||||
public class MyUIPanel : CLPanelLua
|
||||
{
|
||||
[HideInInspector]
|
||||
public string titleKeyName = "";
|
||||
}
|
||||
11
Assets/trCRM/Scripts/ui/MyUIPanel.cs.meta
Normal file
11
Assets/trCRM/Scripts/ui/MyUIPanel.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ff491def90b44724978eb9e0b2b558f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
48
Assets/trCRM/Scripts/ui/MyUIWidgetAdjustWidth.cs
Normal file
48
Assets/trCRM/Scripts/ui/MyUIWidgetAdjustWidth.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class MyUIWidgetAdjustWidth : MonoBehaviour
|
||||
{
|
||||
public UIWidget widget;
|
||||
public int offset = 0;
|
||||
|
||||
public float sizeAdjust = 1;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
if (widget == null)
|
||||
{
|
||||
widget = GetComponent<UIWidget>();
|
||||
}
|
||||
UIRoot root = UIRoot.list[0];
|
||||
sizeAdjust = (root != null) ? root.pixelSizeAdjustment : 1f;
|
||||
sizeAdjust = sizeAdjust < 0.001f ? 1 : sizeAdjust;
|
||||
OnEnable();
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void Update()
|
||||
{
|
||||
OnEnable();
|
||||
}
|
||||
#endif
|
||||
void OnEnable()
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
widget.width = (int)(Screen.width * sizeAdjust - offset * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/trCRM/Scripts/ui/MyUIWidgetAdjustWidth.cs.meta
Normal file
11
Assets/trCRM/Scripts/ui/MyUIWidgetAdjustWidth.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0dbe6448146c445e5ae7040ea035c0fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user