Ejemplo n.º 1
0
        protected override void AddAwake(StringBuilder builder, IEnumerable <string> buttonGameObjects,
                                         IEnumerable <string> toggleGameObjects)
        {
            builder.Append(@"        private void Awake()
        {");
            builder.AppendLine();
            foreach (var gameObjectName in buttonGameObjects)
            {
                builder.Append(string.Format(@"            {0}.onClick.AddListener(OnClick{1});",
                                             NameConverter.ConvertPrivateField(gameObjectName), gameObjectName));
                builder.AppendLine();
            }

            foreach (var gameObjectName in toggleGameObjects)
            {
                builder.Append(string.Format(@"            foreach (var {0} in {1})
                {0}.onValueChanged.AddListener(On{2}Change);",
                                             NameConverter.ToCamel(gameObjectName.Replace("Group", "")),
                                             NameConverter.ConvertPrivateField(gameObjectName),
                                             NameConverter.RemoveGroup(gameObjectName)));
                builder.AppendLine();
            }


            builder.Append("        }");
            builder.AppendLine();
        }
Ejemplo n.º 2
0
        protected override void AddHeader(StringBuilder builder)
        {
            builder.Append(string.Format(@"using NSubstitute;
using NUnit.Framework;

namespace MyModule.{0}
{{
    public class {0}ModelTest
    {{   
        private {0}Model {1}Model;
        private {0}Presenter {1}Presenter;

        [SetUp]
        public void SetUp()
        {{
            {1}Presenter = Substitute.For<{0}Presenter>();
            {1}Model = new {0}Model();
            {1}Model.SetPresenter({1}Presenter);
            throw new System.NotImplementedException();
        }}

        [Test]
        public void TestOnShow()
        {{
            {1}Model.OnShow();
            throw new System.NotImplementedException();
        }}", ModuleName, NameConverter.ConvertPrivateField(ModuleName)));
        }
Ejemplo n.º 3
0
 protected override void AddOnToggleChangeMethod(StringBuilder builder, string gameObjectName)
 {
     builder.Append(string.Format(@"        private void On{0}Change(bool isOn)
 {{
     if (isOn == false) return;
     for (var i = 0; i < {1}.Length; i++)
         if ({1}[i].isOn)
             Presenter.TurnOn{0}(i);
 }}", NameConverter.RemoveGroup(gameObjectName), NameConverter.ConvertPrivateField(gameObjectName)));
 }
Ejemplo n.º 4
0
        protected override void AddOnToggleChangeMethod(StringBuilder builder, string gameObjectName)
        {
            builder.Append(string.Format(@"        [TestCase(0)]
        public void TestTurnOn{0} (int index)
        {{
            // Set

            // Do
            {1}Model.TurnOn{0}(index);

            // Check

            throw new System.NotImplementedException();
        }}", NameConverter.RemoveGroup(gameObjectName), NameConverter.ConvertPrivateField(ModuleName)));
        }
Ejemplo n.º 5
0
        protected override void AddOnButtonClickMethod(StringBuilder builder, string gameObjectName)
        {
            builder.Append(string.Format(@"        [Test]
        public void Test{0} ()
        {{
            // Set

            // Do
            {1}Model.{0} ();

            // Check

            throw new System.NotImplementedException();
        }}", NameConverter.RemoveButton(gameObjectName), NameConverter.ConvertPrivateField(ModuleName)));
        }
Ejemplo n.º 6
0
        protected override void AddHeader(StringBuilder builder)
        {
            builder.Append(string.Format(@"using My.{2}.{0}.Interface;
using NUnit.Framework;

namespace My.{2}.{0}.Impl
{{
    public class {0}ManagerTest
    {{
        private {0}Manager {1}Manager;

        [SetUp]
        public void SetUp()
        {{
            {1}Manager = new {0}Manager();            
        }}
", ModuleName, NameConverter.ConvertPrivateField(ModuleName), LayerName));
        }
Ejemplo n.º 7
0
        protected override void AddHeader(StringBuilder builder)
        {
            builder.Append(string.Format(@"namespace My.{3}.{0}.Interface
{{
    public class {0}Locator : I{0}Manager
    {{
        private static I{0}Manager {1}Manager;

        public static readonly {0}Locator Instance = new {0}Locator();
       
        private {0}Locator()
        {{
        }}
        
        public static void Set(I{0}Manager {2}Manager)
        {{
            {1}Manager = {2}Manager;
        }}
", ModuleName, NameConverter.ConvertPrivateField(ModuleName), NameConverter.ToCamel(ModuleName), LayerName));
        }
Ejemplo n.º 8
0
 protected override void AddField(StringBuilder builder, string gameObjectName, string typeName)
 {
     builder.Append(string.Format(@"        [SerializeField]
 private {0} {1};", typeName, NameConverter.ConvertPrivateField(gameObjectName)));
     builder.AppendLine();
 }