Skip to content

Commit

Permalink
renamed and combined methods (OnInit and OnBind)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael811125 committed Apr 26, 2023
1 parent 433dba7 commit c22ef8f
Show file tree
Hide file tree
Showing 22 changed files with 74 additions and 139 deletions.
6 changes: 6 additions & 0 deletions Assets/OxGFrame/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## [2.0.4] - 2023-04-26
- Renamed BeginInit be OnInit.
- Combined InitOnceComponents and InitOnceEvents be OnBind (after bind will call this method) method.
- Removed InitOnceComponents method.
- Removed InitOnceEvents method.

## [2.0.3] - 2023-04-25
- Fixed unload issue (When ref is zero will call package.UnloadUnusedAssets()).
- Fixed progression calculate bug.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@

public class DemoEntity1 : EPBase
{
public override void BeginInit()
public override void OnInit()
{
Debug.Log($"<color=#FF2A20>InitThis:</color> {this.gameObject.name}");
}

protected override void InitOnceComponents()
protected override void OnBind()
{
Debug.Log($"<color=#FFA720>InitOnceComponents:</color> {this.gameObject.name}");

// Single Bind
Debug.Log($"<color=#FFA720>Found:</color> {this.gameObject.name} => {this.collector.GetNode("B1").name}");

Expand All @@ -23,11 +21,6 @@ protected override void InitOnceComponents()
}
}

protected override void InitOnceEvents()
{
Debug.Log($"<color=#FFE920>InitOnceEvents:</color> {this.gameObject.name}");
}

protected override void OnShow(object obj)
{
Debug.Log($"<color=#6FFF20>OnShow:</color> {this.gameObject.name}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@

public class DemoEntity2 : EPBase
{
public override void BeginInit()
public override void OnInit()
{
Debug.Log($"<color=#FF2A20>InitThis:</color> {this.gameObject.name}");
}

protected override void InitOnceComponents()
protected override void OnBind()
{
Debug.Log($"<color=#FFA720>InitOnceComponents:</color> {this.gameObject.name}");
Debug.Log($"<color=#FFA720>Found:</color> {this.gameObject.name} => {this.collector.GetNode("B1").name}");
Debug.Log($"<color=#FFA720>Found:</color> {this.gameObject.name} => {this.collector.GetNode("B2").name}");
}

protected override void InitOnceEvents()
{
Debug.Log($"<color=#FFE920>InitOnceEvents:</color> {this.gameObject.name}");
}

protected override void OnShow(object obj)
{
Debug.Log($"<color=#6FFF20>OnShow:</color> {this.gameObject.name}");
Expand Down
13 changes: 3 additions & 10 deletions Assets/OxGFrame/CoreFrame/Example/GSFrameDemo/Scripts/DemoRS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class DemoRS : GSBase
{
public override void BeginInit()
public override void OnInit()
{

}
Expand All @@ -30,20 +30,13 @@ protected override void OnShow(object obj)
Debug.Log("DemoRS OnShow");
}

protected override void InitOnceComponents()
protected override void OnBind()
{
/**
* Do Somthing Init Once In Here (For Components)
* Do Somthing Init Once Components and Events In Here
*/
}

protected override void InitOnceEvents()
{
/**
* Do Somthing Init Once In Here (For Events)
*/
}

protected override void OnUpdate(float dt)
{
/**
Expand Down
13 changes: 3 additions & 10 deletions Assets/OxGFrame/CoreFrame/Example/GSFrameDemo/Scripts/DemoSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class DemoSC : GSBase
{
public override void BeginInit()
public override void OnInit()
{
}

Expand All @@ -29,20 +29,13 @@ protected override void OnShow(object obj)
Debug.Log("DemoSC OnShow");
}

protected override void InitOnceComponents()
protected override void OnBind()
{
/**
* Do Somthing Init Once In Here (For Components)
* Do Somthing Init Once Components and Events In Here
*/
}

protected override void InitOnceEvents()
{
/**
* Do Somthing Init Once In Here (For Events)
*/
}

protected override void OnUpdate(float dt)
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Demo1UI : UIBase
private Button oepnBtn;
private Image myImage2;

public override void BeginInit()
public override void OnInit()
{
}

Expand All @@ -33,17 +33,14 @@ protected override void OnShow(object obj)
Debug.Log(string.Format("{0} Do Something OnShow.", this.gameObject.name));
}

protected override void InitOnceComponents()
protected override void OnBind()
{
this.myImage = this.collector.GetNode("Image1")?.GetComponent<Image>();
if (this.myImage != null) Debug.Log(string.Format("Binded GameObject: {0}", this.myImage.name));

this.oepnBtn = this.collector.GetNode("OpenBtn")?.GetComponent<Button>();
if (this.oepnBtn != null) Debug.Log(string.Format("Binded GameObject: {0}", this.oepnBtn.name));
}

protected override void InitOnceEvents()
{
this.oepnBtn.onClick.AddListener(this._ShowDemoPopup2UI);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Demo2UI : UIBase
private Image myImage;
private Button oepnBtn;

public override void BeginInit()
public override void OnInit()
{
}

Expand All @@ -32,17 +32,14 @@ protected override void OnShow(object obj)
Debug.Log(string.Format("{0} - Do Something OnShow.", this.gameObject.name));
}

protected override void InitOnceComponents()
protected override void OnBind()
{
this.myImage = this.collector.GetNode("Image2")?.GetComponent<Image>();
if (this.myImage != null) Debug.Log(string.Format("Binded GameObject: {0}", this.myImage.name));

this.oepnBtn = this.collector.GetNode("OpenBtn")?.GetComponent<Button>();
if (this.oepnBtn != null) Debug.Log(string.Format("Binded GameObject: {0}", this.oepnBtn.name));
}

protected override void InitOnceEvents()
{
this.oepnBtn.onClick.AddListener(this._ShowDemoPopup3UI);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class Demo3UI : UIBase
private Image myImage;
private Button loadSceneBtn;

public override void BeginInit()
public override void OnInit()
{
}

Expand All @@ -32,17 +32,14 @@ protected override void OnShow(object obj)
Debug.Log(string.Format("{0} - Do Something OnShow.", this.gameObject.name));
}

protected override void InitOnceComponents()
protected override void OnBind()
{
this.myImage = this.collector.GetNode("Image3")?.GetComponent<Image>();
if (this.myImage != null) Debug.Log(string.Format("Binded GameObject: {0}", this.myImage.gameObject.name));

this.loadSceneBtn = this.collector.GetNode("LoadSceneBtn")?.GetComponent<Button>();
if (this.loadSceneBtn != null) Debug.Log(string.Format("Binded GameObject: {0}", this.loadSceneBtn.gameObject.name));
}

protected override void InitOnceEvents()
{
this.loadSceneBtn.onClick.AddListener(this._ShowDemoScene);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

public class DemoLoadingUI : UIBase
{
public override void BeginInit()
public override void OnInit()
{
}

Expand All @@ -21,20 +21,13 @@ protected override void CloseSub()
*/
}

protected override void InitOnceComponents()
protected override void OnBind()
{
/**
* Do Somthing Init Once In Here (For Components)
* Do Somthing Init Once Components and Events In Here
*/
}

protected override void InitOnceEvents()
{
/**
* Do Somthing Init Once In Here (For Events)
*/
}

protected override void OnShow(object obj)
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,17 @@ public class #SCRIPTNAME# : EPBase
{
// Use ~Node@XXX to Bind

public override void BeginInit()
public override void OnInit()
{
/**
* Do Somthing Init Once In Here
*/
}

protected override void InitOnceComponents()
protected override void OnBind()
{
/**
* Do Somthing Init Once In Here (For Components)
*/
}

protected override void InitOnceEvents()
{
/**
* Do Somthing Init Once In Here (For Events)
* Do Somthing Init Once Components and Events In Here (For Bind)
*/
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class #SCRIPTNAME# : GSBase
{
// Use _Node@XXX to Bind

public override void BeginInit()
public override void OnInit()
{
/**
* Do Somthing Init Once In Here
Expand All @@ -26,17 +26,10 @@ public class #SCRIPTNAME# : GSBase
*/
}

protected override void InitOnceComponents()
protected override void OnBind()
{
/**
* Do Somthing Init Once In Here (For Components)
*/
}

protected override void InitOnceEvents()
{
/**
* Do Somthing Init Once In Here (For Events)
* Do Somthing Init Once Components and Events In Here (For Bind)
*/
}

Expand All @@ -63,11 +56,15 @@ public class #SCRIPTNAME# : GSBase

protected override void OnClose()
{

/**
* Do Something on close (Close)
*/
}

public override void OnRelease()
{

/**
* Do Something on release (CloseAndDestroy)
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class #SCRIPTNAME# : UIBase
{
// Use _Node@XXX to Bind

public override void BeginInit()
public override void OnInit()
{
/**
* Do Somthing Init Once In Here
Expand All @@ -26,17 +26,10 @@ public class #SCRIPTNAME# : UIBase
*/
}

protected override void InitOnceComponents()
protected override void OnBind()
{
/**
* Do Somthing Init Once In Here (For Components)
*/
}

protected override void InitOnceEvents()
{
/**
* Do Somthing Init Once In Here (For Events)
* Do Somthing Init Once Components and Events In Here (For Bind)
*/
}

Expand Down Expand Up @@ -73,11 +66,15 @@ public class #SCRIPTNAME# : UIBase

protected override void OnClose()
{

/**
* Do Something on close (Close)
*/
}

public override void OnRelease()
{

/**
* Do Something on release (CloseAndDestroy)
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ private void OnDestroy()
AssetLoaders.UnloadAsset(this.assetName);
}

public override void BeginInit() { }
public override void OnInit() { }

public sealed override void InitFirst()
{
base.InitFirst();
}

protected override void InitOnceComponents() { }

protected override void InitOnceEvents() { }
protected override void OnBind() { }

protected override void OnShow(object obj) { }

Expand Down
Loading

0 comments on commit c22ef8f

Please sign in to comment.