Ejemplo n.º 1
0
        public UIManager()
        {
            var bounds = Game.ScreenResolution;

            notifyTimer           = new Timer(5000);
            killInfoTimer         = new Timer(4500);
            scaleformDisplayTimer = new Timer(4000);
            scaleformFadeTimer    = new Timer(2000);
            scaleform             = new Scaleform(Function.Call <int>(Hash.REQUEST_SCALEFORM_MOVIE, "MP_BIG_MESSAGE_FREEMODE"));
            killInfoUI            = new UIBox(new Point(bounds.Width / 2 - (bounds.Width / 2) / 2 + 200, (Game.ScreenResolution.Height - 40) - (Game.ScreenResolution.Height / 10)), new Size(200, 60));
            centerText            = new UIText(null, new Point(bounds.Width / 2 - (bounds.Width / 2) / 2, UI.HEIGHT - 38), 0.70f, Color.White, Font.ChaletComprimeCologne, true);
            teamInfoHUD           = new UIContainer(new Point((int)0.00115f * Game.ScreenResolution.Width + 960, UI.HEIGHT / 6 - 20), new Size(180, Config.MaxTeams * 31), Color.FromArgb(180, Color.Black));
            SetupTeamInfoHUD(Config.MaxTeams);
            _hudAssets[0] = new HUDAsset()
            {
                ActiveAsset = @"scripts\AirSuperiority\hud\fireext\1.png", InactiveAsset = @"scripts\AirSuperiority\hud\fireext\2.png"
            };
            _hudAssets[1] = new HUDAsset()
            {
                ActiveAsset = @"scripts\AirSuperiority\hud\irflares\1.png", InactiveAsset = @"scripts\AirSuperiority\hud\irflares\2.png"
            };
            _hudAssets[2] = new HUDAsset()
            {
                ActiveAsset = @"scripts\AirSuperiority\hud\rdrjam\1.png", InactiveAsset = @"scripts\AirSuperiority\hud\rdrjam\2.png"
            };
            _activeHudAssets = _hudAssets.Select(x => x.ActiveAsset).ToArray();
            SetHUDIcon(2, false);
            rankBar.RankedUp += RankBar_RankedUp;
            Tick             += OnTick;
        }
Ejemplo n.º 2
0
        public static T[] ReadValues <T>(string fileName, string dataType, params string[] attributes)
        {
            var type = typeof(T);

            var xmlData = ReadValues(fileName, dataType, attributes);

            if (type == typeof(TeamInfo))
            {
                var data = new TeamInfo[xmlData.Count];

                for (int i = 0; i < data.Length; i++)
                {
                    var info = new TeamInfo();
                    info.FriendlyName  = xmlData[i]["name"];
                    info.ImageAsset    = @"scripts\AirSuperiority\" + xmlData[i]["imageAsset"];
                    info.AltImageAsset = @"scripts\AirSuperiority\" + xmlData[i]["altAsset"];
                    data[i]            = info;
                }

                return((T[])(object)data);
            }

            else if (type == typeof(HUDAsset))
            {
                var data = new HUDAsset[xmlData.Count];

                for (int i = 0; i < data.Length; i++)
                {
                    var info = new HUDAsset();
                    info.ActiveAsset   = @"scripts\AirSuperiority\" + xmlData[i]["activeIcon"];
                    info.InactiveAsset = @"scripts\AirSuperiority\" + xmlData[i]["inactiveIcon"];
                    data[i]            = info;
                }
                return((T[])(object)data);
            }

            else
            {
                throw new ArgumentException("Unknown type.");
            }
        }