Inheritance: MonoBehaviour
Esempio n. 1
0
        public static void Event(object sender, EventArgs e)
        {
            if (Manage.Loaded || ObjectManager.LocalHero == null)
            {
                return;
            }

            AbilityMain.Me = ObjectManager.LocalHero;
            Manage.Loaded  = true;
            MainMenu.RestartMenu();
            MyAbilities.OffensiveAbilities     = new Dictionary <string, Ability>();
            MyAbilities.DefensiveAbilities     = new Dictionary <string, Ability>();
            MyAbilities.NukesCombo             = new List <Ability>();
            RangeDrawing.RangesDictionary      = new Dictionary <Ability, ParticleEffect>();
            RangeDrawing.RangesValueDictionary = new Dictionary <string, float>();
            GankDamage.IncomingDamages         = new Dictionary <string, float>();
            HpBar.HpBarPositionDictionary      = new Dictionary <string, Vector2>();
            NameManager.NameDictionary         = new Dictionary <float, string>();
            if (AbilityMain.Me.ClassID == ClassID.CDOTA_Unit_Hero_Rubick)
            {
                Rubick.CdDictionary         = new Dictionary <string, bool>();
                Rubick.LastCastedDictionary = new Dictionary <string, Ability>();
                Rubick.MyCdDictionary       = new Dictionary <string, float>();
            }

            MyAbilities.Blink       = null;
            MyAbilities.SoulRing    = null;
            MyAbilities.TinkerRearm = null;
            Dictionaries.Init();
            MainMenu.InitializeMenu();
            MenuInit.AddAllToMenu();
            EnemyHeroes.Heroes            = new List <Hero>();
            AllyHeroes.Heroes             = new List <Hero>();
            EnemyHeroes.UsableHeroes      = new Hero[] { };
            AllyHeroes.UsableHeroes       = new Hero[] { };
            EnemyPlayers.All              = new List <Player>();
            AllyPlayers.All               = new List <Player>();
            AllyTowers.Towers             = new List <Building>();
            EnemyTowers.Towers            = new List <Building>();
            AllyHeroes.AbilityDictionary  = new Dictionary <string, List <Ability> >();
            EnemyHeroes.AbilityDictionary = new Dictionary <string, List <Ability> >();
            AllyHeroes.ItemDictionary     = new Dictionary <string, List <Item> >();
            EnemyHeroes.ItemDictionary    = new Dictionary <string, List <Item> >();
            Manage.SubscribeAllEvents();
            var id    = AbilityMain.Me.ClassID;
            var msg   = "Fully supported";
            var color = "#009900";

            if (id == ClassID.CDOTA_Unit_Hero_Invoker)
            {
                msg   = "Fully supported (configure combo order in Menu>Options>ComboKeys)";
                color = "#009900";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_EarthSpirit)
            {
                msg   = "Not supported (only items will be used)";
                color = "#ff0000";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_EmberSpirit)
            {
                msg   = "Not supported (only items will be used)";
                color = "#ff0000";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_Shredder)
            {
                msg   = "Not supported (only items will be used)";
                color = "#ff0000";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_Wisp)
            {
                msg   = "Not supported (only items will be used)";
                color = "#ff0000";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_Meepo)
            {
                msg   = "Not supported (only items will be used)";
                color = "#ff0000";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_AncientApparition)
            {
                msg   = "Partially supported (will not use ultimate)";
                color = "#ff4400";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_Obsidian_Destroyer)
            {
                msg   = "Partially supported (will not use ultimate)";
                color = "#ff4400";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_Chen)
            {
                msg   = "Partially supported (will not control creeps)";
                color = "#ff4400";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_Warlock)
            {
                msg   = "Partially supported (will not use ultimate)";
                color = "#ff4400";
            }
            else if (id == ClassID.CDOTA_Unit_Hero_StormSpirit)
            {
                msg   = "Partially supported (will not use ultimate)";
                color = "#ff4400";
            }

            Game.PrintMessage(
                "<font face='Tahoma'><font color='#ff6600'>A</font><font color='#ffffff'>BILITY</font><font color='#ffff00'>#</font> loaded - hero <font color='#4488ff'>"
                + (id != ClassID.CDOTA_Unit_Hero_Zuus ? id.ToString().Substring("CDOTA_Unit_Hero_".Length) : "Zeus")
                + "</font>: <font color='" + color + "'>" + msg + "</font></font>",
                MessageType.LogMessage);
        }
Esempio n. 2
0
        protected override void Seed(Com.BitsQuan.Option.Ui.Models.ApplicationDbContext context)
        {
            var mi = new MenuInit();

            mi.Init(context);
            var UserManager = new UserManager <ApplicationUser>(new
                                                                UserStore <ApplicationUser>(context));

            var RoleManager = new RoleManager <ApplicationRole>(new
                                                                RoleStore <ApplicationRole>(context));

            if (!RoleManager.RoleExists("交易员"))
            {
                var roleresult = RoleManager.Create(new ApplicationRole
                {
                    Name = "交易员"
                });
            }
            string iden = DateTime.Now.Subtract(d70).Milliseconds.ToString();

            for (int i = -10; i > -1; i++)
            {
                string name     = "robot" + i * (-1);
                string password = "******";

                var user = new ApplicationUser();
                user.UserName       = name;
                user.IsAllowToTrade = true;
                user.Email          = "*****@*****.**";
                user.PhoneNumber    = "13512341234";
                user.IdNumber       = "123456789012345678";
                user.RegisterTime   = DateTime.Now;
                user.TradePwd       = "123456";
                user.Uiden          = iden;
                user.EmailConfirmed = true;
                user.tradePwdCount  = "n";
                var adminresult = UserManager.Create(user, password);


                if (adminresult.Succeeded)
                {
                    var result = UserManager.AddToRole(user.Id, "交易员");
                }
            }

            for (int i = 1; i < 101; i++)
            {
                string name     = "hello" + i;
                string password = "******";

                var user = new ApplicationUser();
                user.UserName       = name;
                user.IsAllowToTrade = true;
                user.Email          = "*****@*****.**";
                user.PhoneNumber    = "13512341234";
                user.IdNumber       = "123456789012345678";
                user.RegisterTime   = DateTime.Now;
                user.TradePwd       = "123456";
                user.Uiden          = iden;
                user.EmailConfirmed = true;
                user.tradePwdCount  = "n";
                var adminresult = UserManager.Create(user, password);


                if (adminresult.Succeeded)
                {
                    var result = UserManager.AddToRole(user.Id, "交易员");
                }
            }
            // context.SaveChanges();
            List <string> rn = new List <string> {
                "资金管理员", "权限管理员", "网站管理员", "交易管理员"
            };
            List <string> un = new List <string> {
                "cachemgr", "authmgr", "sitemgr", "trademgr"
            };


            for (int i = 0; i < rn.Count; i++)
            {
                if (!RoleManager.RoleExists(rn[i]))
                {
                    var roleresult = RoleManager.Create(new ApplicationRole {
                        Name = rn[i]
                    });
                }
                for (int j = 0; j < 2; j++)
                {
                    var u = new ApplicationUser
                    {
                        UserName       = un[i] + j,
                        Email          = string.Format("mgr{0}@a.com", (i + 1) * j),
                        RegisterTime   = DateTime.Now,
                        PhoneNumber    = (12312312312 + (i + 1) * j).ToString(),
                        Uiden          = iden,
                        EmailConfirmed = true,
                        tradePwdCount  = "n"
                    };
                    var ar = UserManager.Create(u, u.UserName);
                    if (ar.Succeeded)
                    {
                        var r = UserManager.AddToRole(u.Id, rn[i]);
                    }
                }
                //context.SaveChanges();
            }
            ;

            context.SaveChanges();

            var role  = context.Set <ApplicationRole>().Where(a => a.Name == "网站管理员").First();
            var menus = context.Set <Menu>().ToList();

            foreach (var v in menus)
            {
                if (v.Roles == null)
                {
                    v.Roles = new List <ApplicationRole>();
                }
                v.Roles.Add(role);
            }
            role.Menus = menus;
            context.SaveChanges();



            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
        }