//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Thursday, July 27, 2017
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using System;
|
|
|
namespace vnxbqy.UI {
|
|
|
public class TestWin:Window {
|
|
TestModel m_Model;
|
TestModel model { get { return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<TestModel>()); } }
|
|
BusinessEquationController controller = new BusinessEquationController();
|
BusinessEquation test1 = null;
|
BusinessEquation test2 = null;
|
|
public UIEvent testResultOK;
|
public UIEvent testResultOK2;
|
public UIEventInt testResultUnOK;
|
public UIEventInt testResultUnOK2;
|
|
private void Awake() {
|
test1 = new BusinessEquation(controller);
|
test2 = new BusinessEquation(controller);
|
|
controller.busy = false;
|
this.test1.Do(this.RequestUpgrade).When(this.TestUpgrade).OnExpect(ProcessUpgradeOk).OnOutExpect(ProcessUpgradeUnOk);
|
test2.Do(RequestUpgrade2).When(TestUpgrade2).OnExpect(ProcessUpgradeOk2).OnOutExpect(ProcessUpgradeUnOk2);
|
}
|
|
public void dodo1() {
|
test1.Invoke();
|
}
|
|
public void dodo2() {
|
test2.Invoke();
|
}
|
|
private void RequestUpgrade(Action<bool,int> _action) {
|
model.Test1();
|
}
|
|
private bool TestUpgrade(out int _error) {
|
var tempData = UnityEngine.Random.Range(0,2);
|
if(tempData != 0) {
|
_error = tempData;
|
return false;
|
}
|
|
_error = 0;
|
return true;
|
}
|
|
private void ProcessUpgradeOk() {
|
DebugEx.Log("test1成功啦!");
|
}
|
|
private void ProcessUpgradeUnOk(int _error) {
|
DebugEx.Log("test1失败啦!原因是: " + _error);
|
}
|
|
public void RequestUpgrade2(Action<bool,int> _action) {
|
model.Test2(0,1);
|
}
|
|
public bool TestUpgrade2(out int _error) {
|
var tempData = UnityEngine.Random.Range(0,2);
|
if(tempData != 0) {
|
_error = tempData;
|
return false;
|
}
|
|
_error = 0;
|
return true;
|
}
|
|
private void ProcessUpgradeOk2() {
|
DebugEx.Log("test2成功啦!");
|
}
|
|
private void ProcessUpgradeUnOk2(int _error) {
|
DebugEx.Log("test2失败啦!原因是: " + _error);
|
}
|
|
protected override void BindController() {
|
}
|
|
protected override void AddListeners() {
|
}
|
|
protected override void OnPreOpen() {
|
}
|
|
protected override void OnAfterOpen() {
|
}
|
|
protected override void OnPreClose() {
|
}
|
|
protected override void OnAfterClose() {
|
}
|
}
|
|
}
|