Ejemplo n.º 1
0
        public override void Start()
        {
            UIFactroy.CreateLabel(new Vector2Int(7, 10), "jkl今天天气真不错", 5);
            TextBox textBox = UIFactroy.CreateTextBox(new Vector2Int(3, -7), 10, 10);

            textBox.SetText("TransForm", 1);
            textBox.SetText("TransForm124556", 3);
            textBox.Labels[2].GetComponent <Renderer>().Material = new Material(EngineColor.Green, EngineColor.Yellow);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建一个测试用文本框
        /// </summary>
        public static TextBox CreateTestTextBox(Vector2 pos)
        {
            TextBox textBox = UIFactroy.CreateTextBox(pos, 5, 10);

            textBox.SetText("Destroy TextBox", 1);
            Renderer renderer = textBox.Labels[0].GetComponent <Renderer>();

            renderer.SetForeColor(Color.Green);
            textBox.SetText("1.这是一个文本框", 2);
            textBox.SetText("2.文本框没有碰撞", 3);
            textBox.SetText("3.不会随摄像机移动", 4);
            textBox.SetText("4.推箱子玩吧", 5);
            return(textBox);
        }
Ejemplo n.º 3
0
        public override void Awake()
        {
            //这个类是单例且不会随场景销毁的
            Instance = this;

            helpTextBox = UIFactroy.CreateTextBox(new Vector2(Config.ScreenWidth - 12, 0), 5, 10);
            helpTextBox.GameObject.Parent = GameObject;
            var drawing = UIFactroy.CreateBoxDrawingRect(new Vector2(Config.ScreenWidth - 12, 6), 1, 10);

            drawing.Parent = GameObject;
            returnBtn      = UIFactroy.CreateButton(new Vector2(Config.ScreenWidth - 11, 7), "回到主界面", Return, 10);
            returnBtn.GameObject.Parent = GameObject;

            InitText();

            SceneManager.DontDestroyOnLoad(GameObject);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 在场景中创建对象
        /// </summary>
        public override void OnStart()
        {
            //主角位于原点
            GameObject player = TPSFactroy.CreateStandardPlayer("吊", new Vector2(0, 0));

            GameObject.CreateWith <CameraController>().followTrans = player;
            player.AddComponent <Shooter>();

            //创建迷宫地图 位于第三象限
            var maze = MazeGeneration.GetMaze(21, 21, new RenderPoint("■", Color.White, Config.DefaultBackColor, (int)Layer.Environment));

            maze.Position = new Vector2(-25, -25);

            //俄罗斯方块位于第一象限
            for (int x = 5; x < 20; x += 5)
            {
                for (int y = 5; y < 20; y += 5)
                {
                    TPSFactroy.CreateBox(new Vector2(x, y));
                }
            }

            //系统指示器 位于右上角
            SystemUIFactroy.GetSystemInspector();

            //左侧的三个UI组件
            TPSFactroy.CreateTestLable(new Vector2(0, 26));

            ListBox gunBox = UIFactroy.CreateListBox(new Vector2(0, 15), 5, 10);

            gunBox.AddComponent <GunBox>();

            var gunUI = UIFactroy.CreateTextBox(new Vector2(0, 21), 3, 10);

            gunUI.AddComponent <GunUI>();
        }