-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
LK_RD_HB_Tile=Green Shadow On The River | ||
LK_RD_HB_P0=This tree before I was born | ||
LK_RD_HB_P1=Has cast green shadow on the river | ||
LK_RD_HB_P2=One day | ||
LK_RD_HB_P3=A fresh leaf came into eyes | ||
LK_RD_HB_P4=I know it's spring | ||
LK_RD_HB_P5=Happy for a long time | ||
LK_RD_HB_P6=Until autumn comes | ||
LK_RD_HB_P7=A few leaves were dyed yellow by the wind | ||
LK_RD_HB_P8=Soon, they fell down | ||
LK_RD_HB_P9=And my heart was broken |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
LK_RD_HB_Tile=河上的绿影 | ||
LK_RD_HB_P0=这棵树在我出生前就已经伫立在那里了 | ||
LK_RD_HB_P1=绿色的树荫投影在小河平镜般的水中 | ||
LK_RD_HB_P2=有一天 | ||
LK_RD_HB_P3=一片新鲜的树叶映入了我的眼帘 | ||
LK_RD_HB_P4=我晓得那是春天 | ||
LK_RD_HB_P5=为此我高兴了很久 | ||
LK_RD_HB_P6=直到秋天来到 | ||
LK_RD_HB_P7=好些叶子让风染成了金黄 | ||
LK_RD_HB_P8=很快,它们就掉落了 | ||
LK_RD_HB_P9=我很伤心 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/************************************************************************* | ||
* Copyright © 2022 Mogoson. All rights reserved. | ||
*------------------------------------------------------------------------ | ||
* File : HometownBanyan.cs | ||
* Description : Ignore. | ||
*------------------------------------------------------------------------ | ||
* Author : Mogoson | ||
* Version : 1.0 | ||
* Date : 7/30/2022 | ||
* Description : Initial development version. | ||
*************************************************************************/ | ||
|
||
using MGS.Localization; | ||
using System.Collections; | ||
using System.Text; | ||
using UnityEngine; | ||
|
||
namespace MGS.RedDots.Demo | ||
{ | ||
public class HometownBanyan : MonoBehaviour | ||
{ | ||
void Start() | ||
{ | ||
var languages = new string[] { "zh-CN", "en-US" }; | ||
foreach (var language in languages) | ||
{ | ||
var languageFile = string.Format("{0}/MGS.Packages/RedDot/Demo/Language/{1}.txt", Application.dataPath, language); | ||
LocalizationAPI.Handler.Deserialize(language, languageFile, Encoding.UTF8); | ||
} | ||
StartCoroutine(TellALittleStoryAboutABanyan()); | ||
} | ||
|
||
IEnumerator TellALittleStoryAboutABanyan() | ||
{ | ||
var banyan = new Tree(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_Tile")); | ||
var manyLeaves = 3000; | ||
banyan.Grow(manyLeaves); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P0")); yield return new WaitForSeconds(3); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P1")); | ||
|
||
yield return new WaitForSeconds(5); | ||
var freshLeaf = 1; | ||
banyan.Grow(freshLeaf); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P2")); yield return new WaitForSeconds(3); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P3")); yield return new WaitForSeconds(3); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P4")); | ||
AProgrammerShouldDo(banyan); yield return new WaitForSeconds(5); | ||
|
||
var aFewLeaves = 10; | ||
banyan.Dyeing(aFewLeaves, Color.yellow); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P5")); yield return new WaitForSeconds(3); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P6")); yield return new WaitForSeconds(3); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P7")); | ||
AProgrammerShouldDo(banyan); yield return new WaitForSeconds(5); | ||
|
||
banyan.Drop(aFewLeaves); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P8")); yield return new WaitForSeconds(3); | ||
Debug.Log(LocalizationAPI.Handler.GetParagraph("LK_RD_HB_P9")); yield return new WaitForSeconds(1); | ||
AProgrammerShouldDo(banyan); yield return new WaitForSeconds(3); | ||
} | ||
|
||
void AProgrammerShouldDo(Tree arg) | ||
{ | ||
Debug.LogWarningFormat("Please don't forget the logic of a programmer, The state is changed? {0}", arg.IsRed); | ||
arg.Reset(); | ||
Debug.LogWarningFormat("Reset state to {0}", arg.IsRed); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/************************************************************************* | ||
* Copyright © 2022 Mogoson. All rights reserved. | ||
*------------------------------------------------------------------------ | ||
* File : Leaf.cs | ||
* Description : Ignore. | ||
*------------------------------------------------------------------------ | ||
* Author : Mogoson | ||
* Version : 1.0 | ||
* Date : 7/30/2022 | ||
* Description : Initial development version. | ||
*************************************************************************/ | ||
|
||
using UnityEngine; | ||
|
||
namespace MGS.RedDots.Demo | ||
{ | ||
public class Leaf : RedDot | ||
{ | ||
public Color Color | ||
{ | ||
set | ||
{ | ||
if (value != color) | ||
{ | ||
color = value; | ||
IsRed = true; | ||
} | ||
} | ||
get { return color; } | ||
} | ||
protected Color color; | ||
|
||
public int Size | ||
{ | ||
set | ||
{ | ||
if (value != size) | ||
{ | ||
size = value; | ||
IsRed = true; | ||
} | ||
} | ||
get { return size; } | ||
} | ||
protected int size; | ||
|
||
public Leaf(Color color, int size) | ||
{ | ||
this.color = color; | ||
this.size = size; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/************************************************************************* | ||
* Copyright © 2022 Mogoson. All rights reserved. | ||
*------------------------------------------------------------------------ | ||
* File : Tree.cs | ||
* Description : Ignore. | ||
*------------------------------------------------------------------------ | ||
* Author : Mogoson | ||
* Version : 1.0 | ||
* Date : 7/30/2022 | ||
* Description : Initial development version. | ||
*************************************************************************/ | ||
|
||
using UnityEngine; | ||
|
||
namespace MGS.RedDots.Demo | ||
{ | ||
public class Tree : RedDot | ||
{ | ||
public string Name | ||
{ | ||
set | ||
{ | ||
if (value != name) | ||
{ | ||
name = value; | ||
IsRed = true; | ||
} | ||
} | ||
get { return name; } | ||
} | ||
protected string name; | ||
|
||
public Tree(string name) | ||
{ | ||
this.name = name; | ||
} | ||
|
||
public void Grow(int leaves) | ||
{ | ||
for (int i = 0; i < leaves; i++) | ||
{ | ||
var leaf = new Leaf(Color.green, 1); | ||
Register(leaf); | ||
children.Add(leaf); | ||
} | ||
IsRed = true; | ||
} | ||
|
||
public void Drop(int leaves) | ||
{ | ||
for (int i = 0; i < leaves; i++) | ||
{ | ||
if (i < children.Count) | ||
{ | ||
var leaf = children[i] as Leaf; | ||
Unregister(leaf); | ||
children.Remove(leaf); | ||
} | ||
else break; | ||
} | ||
IsRed = true; | ||
} | ||
|
||
public void Dyeing(int leaves, Color color) | ||
{ | ||
for (int i = 0; i < leaves; i++) | ||
{ | ||
if (i < children.Count) | ||
{ | ||
var leaf = children[i] as Leaf; | ||
leaf.Color = color; | ||
} | ||
else break; | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.