Beispiel #1
0
        public void OnClickUpdate()
        {
            CheckString     = (M4uUtil.Random(0, 2) == 0) ? CheckSuccess : CheckFail;
            CheckEnum       = (M4uUtil.Random(0, 2) == 0) ? CheckType.OK : CheckType.NG;
            BoolBindingText = CheckString + "/" + CheckEnum.ToString();

            var time = Time.time;
            var src  = Color;
            var dst  = new UnityEngine.Color(M4uUtil.Random(0f, 1f), M4uUtil.Random(0f, 1f), M4uUtil.Random(0f, 1f), 1f);

            StartCoroutine(UpdateColor(time, src, dst));

            FontStyle            = (UnityEngine.FontStyle)M4uUtil.Random(0, 4);
            FontSize             = M4uUtil.Random(30, 50);
            LineSpacing          = M4uUtil.Random(1f, 2f);
            SupportRichText      = (M4uUtil.Random(0, 2) == 0);
            Alignment            = (TextAnchor)M4uUtil.Random(3, 6);
            ResizeTextForBestFit = (M4uUtil.Random(0, 2) == 0);
            Text  = "[Special]\n";
            Text += "FontStyle=" + FontStyle.ToString() + "\n";
            Text += "LineSpacing=" + LineSpacing + "\n";
            Text += "SupportRichText=" + SupportRichText + "\n";
            Text += "Alignment=" + Alignment.ToString() + "\n";
            Text += "ResizeTextForBestFit=" + ResizeTextForBestFit;
        }
Beispiel #2
0
        void OnClickUpdate()
        {
            MonsterCount = M4uUtil.Random(0, 6);
            MonsterNames = new string[MonsterCount];
            Monsters.Clear();
            for (int i = 0; i < MonsterCount; i++)
            {
                MonsterNames[i] = "Goblin" + i;

                var monster = new MonsterData();
                monster.Name    = MonsterNames [i];
                monster.Texture = Resources.Load("Texture/monster") as Texture;
                Monsters.Add(monster);
            }
        }
Beispiel #3
0
        static void OnHierarchyWindowItemOnGUI(int id, Rect rect)
        {
            var go = EditorUtility.InstanceIDToObject(id) as GameObject;

            if (go == null)
            {
                return;
            }

            var idx = 0;

            foreach (var c in go.GetComponents <Component>())
            {
                var isRoot = (c is M4uContextRoot);
                var isBind = (c is M4uBinding);
                if (isRoot || isBind)
                {
                    idx++;

                    var rootId = id;
                    if (isBind)
                    {
                        var bind = c as M4uBinding;
                        var root = bind.GetRoot();
                        rootId = (root != null) ? root.gameObject.GetInstanceID() : 0;
                    }
                    rootId = Mathf.Abs(rootId);

                    var iconType = (isRoot) ? 0 : 1;
                    var colorIdx = rootId % IconCount;
                    if (icons[iconType, colorIdx] == null)
                    {
                        var path = string.Format(iconPaths[iconType], resPath, colorIdx);
                        icons[iconType, colorIdx] = M4uUtil.CreateTexture2D(File.ReadAllBytes(path));
                    }

                    var icon  = icons[iconType, colorIdx];
                    var irect = new Rect(rect);
                    irect.x     += rect.width - icon.width * idx;
                    irect.width  = icon.width;
                    irect.height = icon.height;

                    GUI.DrawTexture(irect, icon);
                }
            }
        }
Beispiel #4
0
        public void OnClickUpdate()
        {
            DemoData d = DemoContext.Instance.Data;

            d.UserName          = "******" + M4uUtil.Random(1, 100);
            d.UserId            = M4uUtil.Random(1, 100);
            d.CharaSprite       = M4uUtil.LoadSprite("CommonAtlas", ("common_button_" + M4uUtil.Random(1, 3)));
            d.Atk               = M4uUtil.Random(0, 100);
            d.Def               = M4uUtil.Random(0, 100);
            d.BackgroundTexture = M4uUtil.LoadTexture("banner_" + M4uUtil.Random(1, 4));
            d.SoundVolume       = M4uUtil.Random(0f, 1f);
            d.ScrollValue       = M4uUtil.Random(0f, 1f);
            d.IsSet             = (M4uUtil.Random(0, 2) == 0);
            d.Description       = string.Format("My name is {0}!", d.UserName);
            d.ProgressTitle     = "Now progress is ";
            d.Progress          = M4uUtil.Random(0, 100);

            this.CharaX = M4uUtil.Random(-300, 300);
            this.CharaY = M4uUtil.Random(-430, -360);

            Vector3 rot = DemoContextMono.CharaRot;

            DemoContextMono.CharaRot = new Vector3(rot.x, rot.y, M4uUtil.Random(-180, 180));
        }