Inheritance: MonoBehaviour
コード例 #1
0
    public void UpdateHighScores()
    {
        TrackStats track    = GetOrCreate(GameManager.instance.raceInfo.selectedTrack.sceneName);
        RaceInfo   raceInfo = GameManager.instance.raceInfo;

        string lastName;
        float  lastValue;

        if (raceInfo.fastestLap < track.fastestLap.valueInSeconds || track.fastestLap.valueInSeconds == 0)
        {
            lastName  = track.fastestLap.name;
            lastValue = track.fastestLap.valueInSeconds;

            track.fastestLap.valueInSeconds = raceInfo.fastestLap;
            track.fastestLap.name           = "Default";
            Debug.Log("NEW FASTEST LAP!");
            Debug.Log(string.Format("Last Fastest: {0} -{1}", raceInfo.parseTimeFromSeconds(lastValue), lastName));
        }
        if (raceInfo.totalSeconds < track.fastestTotal.valueInSeconds || track.fastestTotal.valueInSeconds == 0)
        {
            lastName  = track.fastestTotal.name;
            lastValue = track.fastestTotal.valueInSeconds;

            track.fastestTotal.valueInSeconds = raceInfo.totalSeconds;
            track.fastestTotal.name           = "Default";
            track.ghost = GameManager.instance.playerGhostData.trackData;

            Debug.Log("NEW FASTEST TOTAL!");
            Debug.Log(string.Format("Last Total: {0} -{1}", raceInfo.parseTimeFromSeconds(lastValue), lastName));
        }

        track.totalPlayTime += raceInfo.totalSeconds;
    }
コード例 #2
0
ファイル: QueriesTests.cs プロジェクト: CaecilieVI/CSharp
        public void GetRaceInfo_given_raceid_returns_raceinfo()
        {
            var listOfCars = new List <CarInfo>();

            var carInfoOne = new CarInfo()
            {
                CarId                = 1,
                CarName              = "The Car",
                DriverName           = "Marston",
                StartPosition        = 1,
                EndPosition          = 2,
                BestLapInTicks       = (long)29867 * 10000,
                TotalRaceTimeInTicks = (long)192835387 * 10000
            };

            var carInfoTwo = new CarInfo()
            {
                CarId                = 2,
                CarName              = "ProX",
                DriverName           = "The Stig",
                StartPosition        = 2,
                EndPosition          = 1,
                BestLapInTicks       = (long)29871 * 10000,
                TotalRaceTimeInTicks = (long)19255387 * 10000
            };

            listOfCars.Add(carInfoOne);
            listOfCars.Add(carInfoTwo);

            var expected = new RaceInfo()
            {
                RaceId       = 1,
                TrackId      = 1,
                TrackName    = "Indianapolis Race Track",
                NumberOfLaps = 100,
                PlannedStart = new DateTime(2017, 9, 21, 12, 0, 0),
                PlannedEnd   = new DateTime(2017, 9, 21, 13, 0, 0),
                ActualStart  = new DateTime(2017, 9, 21, 12, 0, 0),
                ActualEnd    = new DateTime(2017, 9, 21, 13, 30, 0),
            };
            var actual = Queries.GetRaceInfo(expected.RaceId);

            var actualCars = new List <CarInfo>();

            foreach (CarInfo ci in actual.Cars)
            {
                actualCars.Add(ci);
            }

            actual.Cars = null;

            Console.WriteLine(expected.Cars);

            Assert.Equal(expected, actual);

            actual.Cars   = actualCars;
            expected.Cars = listOfCars;

            Assert.Equal(expected.Cars, actual.Cars);
        }
コード例 #3
0
ファイル: QueriesTests.cs プロジェクト: Hjaltejuel/BDSA4
        public void TestRaceInfo()
        {
            using (RaceContext context = new RaceContext())
            {
                context.Races.Clear();
                context.Cars.Clear();
                context.Tracks.Clear();
                context.CarInRaces.Clear();
                context.Cars.AddRange(RaceTestCars);
                context.Tracks.AddRange(RaceTestTracks);
                context.Races.AddRange(RaceTestRaces);
                context.CarInRaces.AddRange(RaceTestCarInRaces);
                context.SaveChanges();
                Queries queries  = new Queries();
                var     raceInfo = queries.GetRaceInfo(RaceTestRaces[2].Id);
                var     expected = new RaceInfo()
                {
                    RaceId       = RaceTestRaces[2].Id,
                    ActualEnd    = RaceTestRaces[2].ActualEndTime,
                    ActualStart  = RaceTestRaces[2].ActualStartTime,
                    NumberOfLaps = RaceTestRaces[2].NumberOfLaps,
                    PlannedEnd   = RaceTestRaces[2].PlannedEndTime,
                    PlannedStart = RaceTestRaces[2].PlannedStartTime,
                    TrackId      = RaceTestRaces[2].Tracks.Id,
                    TrackName    = RaceTestRaces[2].Tracks.Name,

                    Cars = CreateListOfCarInfo(new CarInRaces[3] {
                        RaceTestCarInRaces[2], RaceTestCarInRaces[6], RaceTestCarInRaces[10]
                    })
                };

                Assert.Equal(expected.ToString(), raceInfo.ToString());
            }
        }
コード例 #4
0
ファイル: MainService.cs プロジェクト: dubtar/velotiming
        private async Task Init()
        {
            using (var serviceScope = serviceProvider.CreateScope())
            {
                var services = serviceScope.ServiceProvider;

                try
                {
                    using (var dataContext = services.GetRequiredService <DataContext>())
                    {
                        var activeStart = await dataContext.Starts.Include(s => s.Race).FirstOrDefaultAsync(s => s.IsActive);

                        if (activeStart != null)
                        {
                            var riders = await BuildNumbersDictionary(dataContext, activeStart.Id);

                            Race = new RaceInfo(activeStart, riders);
                            // Load Marks
                            Results.Clear();
                            Results.AddRange(dataContext.Results.Where(r => r.StartId == activeStart.Id));
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(ex.ToString());
                }
            }
        }
コード例 #5
0
ファイル: UIStageMenu.cs プロジェクト: moto2002/snowbattle
    // 更新战友模型相关信息
    void UpdateHelperModel()
    {
        Helper helper = User.Singleton.HelperList.LookupHelper(StageMenu.Singleton.m_curHelperGuid);

        if (null != helper)
        {
            AddHelperModel(helper.m_cardId);

            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(helper.m_cardId);
            if (null != heroInfo)
            {
                m_helperCardName.text  = heroInfo.StrName;
                m_helperCardLevel.text = Localization.Get("CardLevel") + helper.m_cardLevel;
                RaceInfo raceInfo = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type);
                m_helperCardRace.text = raceInfo.m_name;
                OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);
                m_helperCardOcc.text = occInfo.m_name;

                AttrRatioInfo rarityInfo = GameTable.attrRatioTableAsset.LookUp(heroInfo.Occupation, heroInfo.Rarity);
                // 计算生命值
                int hp = (int)((heroInfo.FHPMax + rarityInfo.m_hPMaxAdd * (helper.m_cardLevel - 1)) * rarityInfo.m_hpMutiply);

                m_helperHP.text = hp.ToString();


                // 计算物理攻击力
                int attack = BattleFormula.GetPhyAttack(helper.m_cardId, 1);
                m_helperPhyAttack.text = attack.ToString();

                // 魔法攻击力
                attack = BattleFormula.GetMagAttack(helper.m_cardId, 1);
                m_helperMagAttack.text = attack.ToString();
            }
        }
    }
コード例 #6
0
 private void Start()
 {
     if (camp != PlayerController.instance.camp)
     {
         Race = ArtResourceManager.instance.RaceInfos[Random.Range(0, 2)];
     }
     InGameManager.instance.RegistCardManager(this);
 }
コード例 #7
0
        private void _lbHorde_Selected(object sender, MouseButtonEventArgs e)
        {
            if (_lbHorde.SelectedIndex != -1)
            {
                raceInfo = _lbHorde.SelectedItem as RaceInfo;

                ChangeCharacter();
            }
        }
コード例 #8
0
ファイル: Display.cs プロジェクト: Jvdtuin/CodinGame
 private void button1_Click(object sender, EventArgs e)
 {
     _raceInfo = new RaceInfo();
     race      = new Race(_raceInfo);
     DrawMap();
     for (int j = 0; j < race.Pods.Length; j++)
     {
         DrawPod(race.Pods[j], colors[j]);
     }
 }
コード例 #9
0
ファイル: RaceInfoTable.cs プロジェクト: moto2002/snowbattle
    public RaceInfo LookUp(int id)
    {
        RaceInfo info = null;

        if (m_map.TryGetValue(id, out info))
        {
            return(info);
        }

        return(null);
    }
コード例 #10
0
    public ScriptPlayerRaceInfo(string name, GameLayout layout)
        :
        base(name, layout)
    {
        mRaceInfoList = new RaceInfo[GameDefine.MAX_AI_COUNT + 1];
        int count = mRaceInfoList.Length;

        for (int i = 0; i < count; ++i)
        {
            mRaceInfoList[i] = new RaceInfo(this);
        }
    }
コード例 #11
0
ファイル: Race.cs プロジェクト: Jvdtuin/CodinGame
        public Race(RaceInfo raceInfo, IPodBrain[] podBrains)
        {
            _podBrains = podBrains;
            _raceInfo  = raceInfo;
            _pods      = new Pod[podBrains.Length];

            for (int i = 0; i < podBrains.Length; i++)
            {
                _pods[i] = podBrains[i].GetPod();
            }
            InitializePods(_pods.Length);
        }
コード例 #12
0
        /// <summary>
        /// Indexes this instance.
        /// </summary>
        /// <returns>ActionResult.</returns>
        public ActionResult Index()
        {
            var tracks   = trackService.GetAllTracks();
            var raceInfo = new RaceInfo
            {
                Tracks          = tracks,
                SelectedTrack   = tracks[0],
                SelectedTrackId = tracks[0].Id,
            };

            return(View("Race", raceInfo));
        }
コード例 #13
0
        public bool UpdateUI(uint raceid, bool female, string classname)
        {
            foreach (object item in _lbAlliance.Items)
            {
                RaceInfo r = item as RaceInfo;
                if (r.RaceId == raceid)
                {
                    this.raceInfo            = r;
                    _lbAlliance.SelectedItem = item;
                    break;
                }
            }

            foreach (object item in _lbHorde.Items)
            {
                RaceInfo r = item as RaceInfo;
                if (r.RaceId == raceid)
                {
                    this.raceInfo         = r;
                    _lbHorde.SelectedItem = item;
                    break;
                }
            }

            this.female = female;

            _rbFemale.Checked   -= _rbFemale_Checked;
            _rbFemale.Unchecked -= _rbFemale_Unchecked;
            _rbFemale.IsChecked  = this.female;
            _rbMale.IsChecked    = !this.female;
            _rbFemale.Checked   += _rbFemale_Checked;
            _rbFemale.Unchecked += _rbFemale_Unchecked;

            _rbNew.Checked   -= _rbNewModel_Checked;
            _rbNew.Unchecked -= _rbNewModel_Unchecked;
            _rbOld.IsChecked  = !ModelEditorService.Instance.IsCharacterHD;
            _rbNew.IsChecked  = ModelEditorService.Instance.IsCharacterHD;
            _rbNew.Checked   += _rbNewModel_Checked;
            _rbNew.Unchecked += _rbNewModel_Unchecked;

            classShortName = classname;

            UpdateMaxCharFeature();
            UpdateCurrentCharFeature();
            UpdateStartOutfitClasses();
            SelectClass(classShortName, false);

            return(true);
        }
コード例 #14
0
    void Start()
    {
        // Set initial local position
        localPosition = 1;

        // Reset already registered cars
        alreadyRegisteredCars = new List <int>();

        // Record start time of the race
        startTimeMillis = getTimeMillis();

        // Get ranking controller reference
        if (ranking == null)
        {
            GameObject rankingObj = GameObject.Find("Ranking");
            if (rankingObj != null)
            {
                ranking = rankingObj.GetComponent <RankingController>();
            }
        }

        // Get race info reference
        if (raceInfo == null)
        {
            GameObject dataObj = GameObject.Find(SelectMenu.DATA_GAMEOBJECT_NAME);
            if (dataObj != null)
            {
                raceInfo = dataObj.GetComponent <RaceInfo>();
            }
        }

        // Set cars for each player/CPU
        if (raceInfo != null && characterSprites != null)
        {
            int cpusWithNewSprite = 0;
            foreach (CharacterSprite cs in characterSprites)
            {
                if (cs.name == raceInfo.character)
                {
                    playerSpriteRenderer.sprite = cs.sprite;
                }
                else if (cpusWithNewSprite < cpuSpriteRenderers.Length)
                {
                    cpuSpriteRenderers[cpusWithNewSprite++].sprite = cs.sprite;
                }
            }
        }
    }
コード例 #15
0
ファイル: RaceInfoTable.cs プロジェクト: moto2002/snowbattle
    public void Load(byte[] bytes)
    {
        m_map = new Dictionary <int, RaceInfo>();
        BinaryHelper helper = new BinaryHelper(bytes);

        int sceneCount = helper.ReadInt();

        for (int index = 0; index < sceneCount; ++index)
        {
            RaceInfo info = new RaceInfo();

            info.Load(helper);

            m_map.Add(info.m_id, info);
        }
    }
コード例 #16
0
        public void Post(RaceInfo value)
        {
            try
            {
                _raceService.SaveRacePicks(SecurityHelpers.GetUserId(), value);
            }
            catch (Exception ex)
            {
                var resp = new HttpResponseMessage(HttpStatusCode.BadRequest)
                {
                    Content      = new StringContent(ex.Message),
                    ReasonPhrase = "Invalid Request"
                };

                throw new HttpResponseException(resp);
            }
        }
コード例 #17
0
ファイル: Optimizer.cs プロジェクト: Jvdtuin/CodinGame
        public int RunRace(RaceInfo raceInfo, double[] factors)
        {
            int i = 0;

            IPodBrain[] brains = new IPodBrain[1];
            brains[0] = new TransformedPodBrain();
            Pod pod = new Pod();

            brains[0].SetConditions(pod, raceInfo, factors);
            Race race = new Race(raceInfo, brains);

            do
            {
                i++;
            } while ((i < 2000) && (!race.Move().HasValue));

            return(i);
        }
コード例 #18
0
ファイル: PlayerHUD.cs プロジェクト: Rarau/racing_game
    // Use this for initialization
    public void Initialize()
    {
        lastLap = 0;
        lastPos = 0;
        if (carController != null)
        {
            GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceCamera;
            GetComponent<Canvas>().planeDistance = 0.5f;
            GetComponent<Canvas>().worldCamera = carController.GetComponentInChildren<Camera>();
            GetComponentInChildren<RevCounter>().car = carController;
            GetComponentInChildren<MilesCounter>().car = carController;
            lapCounter = transform.FindChild("LapCounter/LapCount").GetComponent<Text>();
            posCounter = transform.FindChild("PosCounter/PosCount").GetComponent<Text>();

            raceInfo = carController.GetComponent<RaceInfo>();
            lapCounter.text = (raceInfo.lap - 1) + "/" + FindObjectOfType<GameManager>().numberOfLaps;
        }
    }
コード例 #19
0
ファイル: Race.cs プロジェクト: Jvdtuin/CodinGame
        public Race(RaceInfo raceInfo)
        {
            _raceInfo = raceInfo;
            int podCount = 2;

            _pods = new Pod[podCount];
            for (int i = 0; i < podCount; i++)
            {
                _pods[i] = new Pod();
            }
            _podBrains = new IPodBrain[podCount];
            InitializePods(podCount);
            _podBrains[0] = new GeneticBrain();
            _podBrains[0].SetConditions(_pods[0], _raceInfo, null);
            _podBrains[1] = new TransformedPodBrain(); _podBrains[1].SetConditions(_pods[1], _raceInfo, new[] { 2.342, 30.91, 0.02181 });
            //   _podBrains[1] = new SimpleSeekPodBrain(_pods[1], _raceInfo, new[] { 2.5 });
            //   _podBrains[2] = new SimpleSeekPodBrain(_pods[2], _raceInfo, new[] { 3.0 });
            //   _podBrains[3] = new SimpleSeekPodBrain(_pods[3], _raceInfo, new[] { 4.0 });
        }
コード例 #20
0
        public List <RaceInfo> GetRaces(int runnerId)
        {
            var reader = Reader.GetTableReader(RunnerRequest.Races(runnerId));
            var races  = new List <RaceInfo>();

            while (reader.Read())
            {
                var race = new RaceInfo(
                    reader["Gender"].ToString(),
                    reader["DateOfBirth"].ToString(),
                    reader["RaceTime"].ToString(),
                    reader["CountryName"].ToString(),
                    reader["EventTypeName"].ToString(),
                    reader["YearHeld"].ToString()
                    );
                races.Add(race);
            }
            return(races);
        }
コード例 #21
0
ファイル: Optimizer.cs プロジェクト: Jvdtuin/CodinGame
        public Optimizer(int numRaces)
        {
            _numRaces = numRaces;
            _races    = new RaceInfo[numRaces];

            for (int i = 0; i < numRaces; i++)
            {
                _races[i] = new RaceInfo();
            }

            for (int i = 0; i < 100; i++)
            {
                _population.Add(new Creature()
                {
                    genome = new[] { _random.NextDouble() * 5.0, _random.NextDouble() * 600.0, _random.NextDouble() * 0.2 }
                });
            }
            _genomeSize = 3;
        }
コード例 #22
0
        public static void Main(string[] args)
        {
            RaceInfo raceInfo = new RaceInfo {
                Id           = 0,
                CourseLength = CourseLength,
                Runners      = Runners
            };

            Race       race   = new Race(raceInfo, Interval);
            RaceResult result = race.RunRace();

            List <int> positions = result.GetPositions();

            for (int i = 0; i < positions.Count; i++)
            {
                System.Console.WriteLine("Position {0} is {1}", i + 1, Runners.Find(h => h.Id == positions[i]).Id);
            }

            System.Console.ReadLine();
        }
コード例 #23
0
    private void PassInfoToCircuit(bool specialMode)
    {
        GameObject dataObj = GameObject.Find(DATA_GAMEOBJECT_NAME);

        if (dataObj == null)
        {
            dataObj = new GameObject(DATA_GAMEOBJECT_NAME);
        }
        RaceInfo raceInfo = dataObj.GetComponent <RaceInfo>();

        if (raceInfo == null)
        {
            raceInfo = dataObj.AddComponent <RaceInfo>();
        }

        raceInfo.playerName = nameInput == null || string.IsNullOrWhiteSpace(nameInput.text) ? PLAYER_NAME_DEFAULT : nameInput.text;
        raceInfo.circuit    = specialMode ? "SPECIAL-MODE" : "NORMAL-MODE";
        raceInfo.character  = selectedCharacter;
        raceInfo.reverse    = specialMode;

        DontDestroyOnLoad(dataObj);
    }
コード例 #24
0
    void ShowRepresentativeCardInfo(CSItemGuid guid)
    {
        m_RCOption.SetActive(true);

        CSItem card = CardBag.Singleton.GetCardByGuid(guid);

        HeroInfo hero = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

        if (null == hero)
        {
            Debug.LogWarning("null == hero card.IDInTable:" + card.IDInTable);
            return;
        }

        IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(hero.ImageId);

        RaceInfo race = GameTable.RaceInfoTableAsset.LookUp(hero.Type);

        OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(hero.Occupation);

        // 图片
        FindChildComponent <UITexture>("CardPic", m_RCOption).mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
        GameObject info = FindChild("Info", m_RCOption);

        FindChildComponent <UILabel>("InfoName", info).text      = hero.StrName;
        FindChildComponent <UILabel>("InfoLevel", info).text     = Localization.Get("CardLevel") + card.Level;
        FindChildComponent <UILabel>("InfoOp", info).text        = occupationInfo.m_name;
        FindChildComponent <UILabel>("InfoHp", info).text        = card.GetHp().ToString();
        FindChildComponent <UILabel>("InfoMagAttack", info).text = card.GetMagAttack().ToString();
        FindChildComponent <UILabel>("InfoPhyAttack", info).text = card.GetPhyAttack().ToString();
        FindChildComponent <UILabel>("InfoRace", info).text      = race.m_name;


        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(hero.Rarity);

        icon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
        FindChildComponent <UITexture>("InfoRank", info).mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
    }
コード例 #25
0
ファイル: SimplePodBrain.cs プロジェクト: Jvdtuin/CodinGame
 public void SetConditions(Pod pod, RaceInfo raceInfo, double[] factors)
 {
     _pod      = pod;
     _raceInfo = raceInfo;
     _factor   = factors[0];
 }
コード例 #26
0
ファイル: SimplePodBrain.cs プロジェクト: Jvdtuin/CodinGame
 public SimpleSeekPodBrain(Pod pod, RaceInfo raceInfo, double[] factors)
 {
     _pod      = pod;
     _raceInfo = raceInfo;
     _factor   = factors[0];
 }
コード例 #27
0
ファイル: SimplePodBrain.cs プロジェクト: Jvdtuin/CodinGame
 public SimplePodBrain(Pod pod, RaceInfo raceInfo)
 {
     _pod      = pod;
     _raceInfo = raceInfo;
 }
コード例 #28
0
ファイル: SelectRaceScreen.cs プロジェクト: sikora507/OpenC1
 public RaceOption(RaceInfo info)
 {
     _info = info;
 }
コード例 #29
0
        private async void CreateLayout()
        {
            customMap = new CustomMap
            {
                IsShowingUser     = true,
                HeightRequest     = App.ScreenSize.Height / 5,
                WidthRequest      = 960,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            var place = locator.GetLocation();

            if (place == null)
            {
                customMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(0, 0), Distance.FromKilometers(1)));
            }
            else
            {
                customMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(place.Latitude, place.Longitude), Distance.FromKilometers(1)));
            }

            var lastTrail = await apiServices.GetLastTrail();

            if (lastTrail != null)
            {
                if (!String.IsNullOrEmpty(lastTrail.Name))
                {
                    foreach (var poi in lastTrail.Poi)
                    {
                        var pin = new CustomPin()
                        {
                            Position = new Position(poi.Latitude, poi.Longitude),
                            Label    = poi.Type.ToString(),
                            Id       = poi.Type,
                            IconUrl  = poi.IconUlr,
                            Poi      = new POI()
                            {
                                Description = poi.Description,
                                Type        = poi.Type
                            }
                        };

                        pin.InfoClicked += (sender) =>
                        {
                            var pinSelected = sender;
                            Navigation.PushModalAsync(new POIView(pinSelected));
                        };

                        customMap.PinsCoordinates.Add(pin);
                    }

                    foreach (var pos in lastTrail.TrailPath)
                    {
                        customMap.RouteCoordinates.Add(new Position(pos.Latitude, pos.Longitude));
                    }
                }
            }

            lblHour = new Label()
            {
                Text     = "00",
                FontSize = 50
            };
            lblMinute = new Label()
            {
                Text     = "00",
                FontSize = 50
            };
            lblSecond = new Label()
            {
                Text     = "00",
                FontSize = 30
            };

            lblDistace = new Label()
            {
                Text              = "0.0 Km",
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center
            };

            var info = new RaceInfo()
            {
                StartTime   = DateTime.Now,
                Poi         = new System.Collections.Generic.List <POI>(),
                TrailPath   = new System.Collections.Generic.List <Location>(),
                Description = "Esta é minha mais nova trilha! =D",
                Name        = "Nova trilha"
            };
            var state = false;

            btnBegin = new Button()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = "Iniciar",
                BackgroundColor = Color.FromHex("#4CAF50"),
                TextColor       = Color.White
            };
            btnBegin.Clicked += async delegate
            {
                state = !state;
                if (state)
                {
                    btnBegin.Text            = "Parar";
                    btnBegin.BackgroundColor = Color.FromHex("#F44336");
                    Device.StartTimer(TimeSpan.FromMilliseconds(1000), () =>
                    {
                        info.Time = info.Time.AddSeconds(1);

                        lblSecond.Text = info.Time.Second.ToString();
                        lblMinute.Text = info.Time.Minute.ToString();
                        lblHour.Text   = info.Time.Hour.ToString();

                        return(state);
                    });
                }
                else
                {
                    await Navigation.PushAsync(new RunDetailPage(info));

                    state = !state;
                }
            };

            btnDanger = new Button()
            {
                Text              = "SOCORRO!",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                TextColor         = Color.White,
                BackgroundColor   = Color.FromHex("#F44336")
            };
            btnDanger.Clicked += async delegate
            {
                await DisplayAlert("Aguente Firme!", "Não se preocupe!\nOs trilheiros mais próximos a você serão alertados!", "OKAY!");

                intents.Call("192");
            };

            Content = new StackLayout()
            {
                Children =
                {
                    customMap,
                    new StackLayout()
                    {
                        Padding  = new Thickness(5,                             5, 5, 5),
                        Children =
                        {
                            new Frame()
                            {
                                VerticalOptions = LayoutOptions.Center,
                                Content         = new StackLayout()
                                {
                                    Children =
                                    {
                                        new StackLayout()
                                        {
                                            Orientation       = StackOrientation.Horizontal,
                                            VerticalOptions   = LayoutOptions.Center,
                                            HorizontalOptions = LayoutOptions.Center,
                                            Children          =
                                            {
                                                lblHour,
                                                new Label()
                                                {
                                                    Text            = ":",
                                                    FontSize        = 25,
                                                    VerticalOptions = LayoutOptions.Center
                                                },
                                                lblMinute,
                                                new Label()
                                                {
                                                    Text            = ":",
                                                    FontSize        = 25,
                                                    VerticalOptions = LayoutOptions.Center
                                                },
                                                lblSecond
                                            }
                                        },
                                        lblDistace
                                    }
                                }
                            },
                            new StackLayout()
                            {
                                Orientation       = StackOrientation.Horizontal,
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                                VerticalOptions   = LayoutOptions.FillAndExpand,
                                Children          =
                                {
                                    new StackLayout()
                                    {
                                        HorizontalOptions = LayoutOptions.FillAndExpand,
                                        VerticalOptions   = LayoutOptions.FillAndExpand,
                                        Children          =
                                        {
                                            btnBegin
                                        }
                                    },
                                    btnDanger
                                }
                            }
                        }
                    }
                }
            };
        }
コード例 #30
0
ファイル: SelectRaceScreen.cs プロジェクト: vaginessa/OpenC1
 public RaceOption(RaceInfo info)
 {
     _info = info;
 }
コード例 #31
0
ファイル: UIChooseCard.cs プロジェクト: moto2002/snowbattle
    void UpdateCardInfo(int cardId)
    {
        Debug.Log("UpdateCardInfo:" + cardId);
        m_cardDetail.SetActive(true);

        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardId);

        if (null == heroInfo)
        {
            return;
        }

        Login.Singleton.m_curCardId = cardId;

        IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId);

        m_infoName.text = heroInfo.StrName;

        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);
        IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);

        m_star.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
        m_cardPic.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);

        OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);

        RaceInfo raceInfo = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type);

        m_infoOp.text = occInfo.m_name;

        m_ocInfo.text = occInfo.m_name;

        m_raceInfo.text = raceInfo.m_name;

        m_ocDetail.text = occInfo.m_describe;

        int        i           = 0;
        List <int> skillIDList = heroInfo.GetAllSkillIDList();

        foreach (int skillId in skillIDList)
        {
            SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId);
            if (null == skillInfo || 0 != skillInfo.SkillType)
            {
                continue;
            }

            iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);

            if (iconInfo == null)
            {
                Debug.LogWarning("iconInfo 为空 skillId:" + skillId + ",skillInfo.Icon:" + skillInfo.Icon);
                continue;
            }
            if (m_skillList.ContainsKey(skillId))
            {
                GameObject obj = m_skillList[skillId];
                obj.SetActive(true);
                obj.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                Parma parma = obj.GetComponent <Parma>();
                parma.m_id = skillId;
            }
            else
            {
                GameObject copy = GameObject.Instantiate(m_skillItem.gameObject) as GameObject;
                copy.transform.parent     = m_skillParent.transform;
                copy.transform.localScale = m_skillItem.transform.localScale;
                copy.gameObject.SetActive(true);
                copy.transform.LocalPositionX(0 + i * 90f);
                copy.transform.LocalPositionY(-45f);
                copy.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                copy.name = copy.name + i;
                Parma parma = copy.GetComponent <Parma>();
                parma.m_id = skillId;

                EventDelegate.Add(copy.GetComponent <UIEventTrigger>().onPress, OnShowTips);

                AddChildMouseClickEvent(copy.name, OnHideTips);

                m_skillList.Add(skillId, copy);
            }
            i++;
        }
    }
コード例 #32
0
ファイル: UICardDetail.cs プロジェクト: moto2002/snowbattle
    // 更新信息
    void UpdateInfo()
    {
        CSItem card = CardBag.Singleton.m_cardForDetail;

        if (null == card)
        {
            return;
        }

        // 如果卡牌ID为0则 是用预览卡牌(不是背包里的卡牌) 此时 加到最爱 进化 强化等按钮不显示
        if (CardBag.Singleton.m_curOptinGuid.Equals(CSItemGuid.Zero))
        {
            m_levelUpBtn.gameObject.SetActive(false);

            m_evolutionBtn.gameObject.SetActive(false);

            m_breachBtn.gameObject.SetActive(false);
        }
        else
        {
            m_levelUpBtn.gameObject.SetActive(card.IsStengthen());

            m_evolutionBtn.gameObject.SetActive(card.IsEvlotion());

            m_breachBtn.gameObject.SetActive(true);
        }
        m_grid.Reposition();
        AddModel(card, m_model);
        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

        if (null == heroInfo)
        {
            Debug.LogWarning("heroInfo == NULL heroInfo cardID:" + card.IDInTable);
            return;
        }

        m_cardPanel.Update(card.IDInTable);

        IconInfomation iconInfo       = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId);
        OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);
        RaceInfo       raceInfo       = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type);

//        LevelUpInfo levelupInfo         = GameTable.LevelUpTableAsset.LookUp(card.Level);
        m_cost.text       = "" + heroInfo.Cost;
        m_phyAttack.text  = "" + (int)card.GetPhyAttack();
        m_magAttack.text  = "" + (int)card.GetMagAttack();
        m_hp.text         = "" + (int)card.GetHp();
        m_occupation.text = occupationInfo.m_name;
        m_type.text       = raceInfo.m_name;
        m_curLevel.text   = "" + card.Level;
        m_maxLevel.GetComponent <UILabel>().text = card.GetMaxLevel().ToString();

        IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);

        m_occTexture.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
        icon = GameTable.IconInfoTableAsset.Lookup(raceInfo.m_iconId);
        m_raceTexture.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

        // 段位升级
        UpdateDanData(card.BreakCounts);

        foreach (UICardDetailSkillItem item in m_skillList)
        {
            if (null != item)
            {
                item.HideWindow();
            }
        }

        foreach (UICardDetailSkillItem item in m_passvieSkillList)
        {
            if (null != item)
            {
                item.HideWindow();
            }
        }

        int        i           = 0;
        List <int> skillIDList = heroInfo.GetAllSkillIDList();

        foreach (int skillId in skillIDList)
        {
            if (0 != heroInfo.NormalSkillIDList.Find(item => item == skillId))
            {
                continue;
            }
            SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId);
            if (null == skillInfo)
            {
                continue;
            }

            // 普通技能才被列入
            if (skillInfo.SkillType != 0)
            {
                continue;
            }
            iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);

            if (null == iconInfo)
            {
                continue;
            }
            if (i < m_skillList.Length)
            {
                UICardDetailSkillItem item = m_skillList[i];
                if (null == item)
                {
                    item           = UICardDetailSkillItem.Create();
                    m_skillList[i] = item;
                    item.SetParent(m_skillParent.transform);
                    item.SetPressCallbacked(OnShowTips);
                    item.SetClickCallbacked(OnHideTips);
                }

                item.ShowWindow();
                item.Update(skillId);
                i++;
            }
        }

        m_skillParent.GetComponent <UIGrid>().Reposition();

        i = 0;
        bool bNone = true;

        foreach (int skillId in heroInfo.PassiveSkillIDList)
        {
            SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId);
            if (null == skillInfo)
            {
                continue;
            }
            iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);
            if (null == iconInfo)
            {
                continue;
            }
            if (i >= m_passvieSkillList.Length)
            {
                continue;
            }

            bNone = false;

            UICardDetailSkillItem item = m_passvieSkillList[i];
            if (null == item)
            {
                item = UICardDetailSkillItem.Create();
                m_passvieSkillList[i] = item;
                item.SetParent(m_passiveSkillParent.transform);

                item.SetPressCallbacked(OnShowTips);
                item.SetClickCallbacked(OnHideTips);
            }

            item.ShowWindow();
            item.Update(skillId);
            i++;
        }

        m_passiveSkillParent.GetComponent <UIGrid>().Reposition();
        m_skillNoneLabel.gameObject.SetActive(bNone);
    }
コード例 #33
0
ファイル: MabiCreature.cs プロジェクト: pjm0616/aura
        public void LoadDefault()
        {
            if (this.Race == uint.MaxValue)
                throw new Exception("Set race before calling LoadDefault.");

            var dbInfo = MabiData.RaceDb.Find(this.Race);
            if (dbInfo == null)
            {
                // Try to default to Human
                dbInfo = MabiData.RaceDb.Find(10000);
                if (dbInfo == null)
                {
                    throw new Exception("Unable to load race defaults, race '" + this.Race.ToString() + "' not found.");
                }
                Logger.Warning("Race '" + this.Race.ToString() + "' not found, using human instead.");
            }

            DefenseBase = dbInfo.Defense;
            ProtectionBase = dbInfo.Protection;

            this.RaceInfo = dbInfo;

            this.StatRegens.Add(this.LifeRegen = new MabiStatRegen(Stat.Life, 0.12f, this.LifeMax));
            this.StatRegens.Add(this.ManaRegen = new MabiStatRegen(Stat.Mana, 0.05f, this.ManaMax));
            this.StatRegens.Add(this.StaminaRegen = new MabiStatRegen(Stat.Stamina, 0.4f, this.StaminaMax));
            //_statMods.Add(new MabiStatMod(Stat.Food, -0.01f, this.StaminaMax / 2));

            if (MabiTime.Now.IsNight)
                this.ManaRegen.ChangePerSecond *= 3;

            this.HookUp();
        }