Beispiel #1
0
        public override EvtNextBeatKeyAdded[] GenerateTargetsForBeat(BeatInfo info, float timePerBeat, KeyInfoComponent _keyInfoComponent)
        {
            if (_lastBeatNumberGenerated + _minDistanceBetweenBeets > info.BeatNo)
            {
                return(new EvtNextBeatKeyAdded[0]);
            }
            var generatorVal = (int)(Random.value * 2f);

            if (generatorVal != 0)
            {
                return(new EvtNextBeatKeyAdded[0]);
            }

            _lastBeatNumberGenerated = info.BeatNo;
            var key = _keyInfoComponent.RelevantKeys[(int)(Random.value * _keyInfoComponent.RelevantKeys.Length)];

            return(new[]
            {
                new EvtNextBeatKeyAdded
                {
                    Id = Time.frameCount,
                    Key = key,
                    BeatNo = info.BeatNo + BeatDistance,
                    PlannedBeatTime = info.BeatTime + (timePerBeat * BeatDistance),
                }
            });
        }
Beispiel #2
0
        public void DrawChordAt(BeatInfo leftBeat, BeatInfo rightBeat)
        {
            int leftPos  = TL.Time2Pos(leftBeat.Time);
            int rightPos = TL.Time2Pos(rightBeat.Time);

            if (leftBeat.ChordTag != null)
            {
                string     chordName      = leftBeat.ChordTag.ToString(leftBeat.Tonalty);
                SolidBrush brush          = new SolidBrush(ColorSchema.GetTransparentColorByChordName(chordName));
                Color      chordTextColor = ColorSchema.GetColorByChordName(chordName);
                if (TL.RelativeLabel)
                {
                    TL.G.FillRectangle(brush,
                                       new Rectangle(leftPos, TL.HorizonHeight - 30, rightPos - leftPos, 30));
                    TL.G.DrawString(chordName, chordFont, new SolidBrush(chordTextColor), leftPos, TL.HorizonHeight - 30f);
                }
                else
                {
                    TL.G.FillRectangle(brush, new Rectangle(leftPos, TL.HorizonHeight - 30, rightPos - leftPos, 30));
                    TL.G.DrawString(leftBeat.ChordTag.ToString(), chordFont, new SolidBrush(chordTextColor), leftPos, TL.HorizonHeight - 30f);
                }
                int[] notes = leftBeat.ChordTag.ToNotes();
                foreach (int note in notes)
                {
                    Rectangle rect = new Rectangle(leftPos, TL.ChromaVisualizer.ChromaStart + (11 - note) * TL.ChromaVisualizer.ChromaHeight, rightPos - leftPos, TL.ChromaVisualizer.ChromaHeight);
                    TL.G.FillRectangle(brush, rect);
                    TL.G.DrawRectangle(new Pen(chordTextColor), rect);
                }
            }
        }
Beispiel #3
0
        public override EvtNextBeatKeyAdded[] GenerateTargetsForBeat(BeatInfo info, float timePerBeat, KeyInfoComponent _keyInfoComponent)
        {
            if (info.BeatNo % 6 != 0)
            {
                return(new EvtNextBeatKeyAdded[0]);
            }
            if (Random.value < 0.1)
            {
                return(new EvtNextBeatKeyAdded[0]);                    // pause
            }
            var list       = new List <EvtNextBeatKeyAdded>();
            var generation = Random.Range(0, 4);

            switch (generation)
            {
            case 0: list = GenerateRandomKeys(info, timePerBeat, _keyInfoComponent);
                break;

            case 1:
                list = GenerateRandomFast(info, timePerBeat, _keyInfoComponent);
                break;

            case 2:
                list = GenerateFirst(info, timePerBeat, _keyInfoComponent);
                break;

            case 3:
                list = GenerateSecond(info, timePerBeat, _keyInfoComponent);
                break;
            }

            return(list.ToArray());
        }
Beispiel #4
0
        public async Task SendBeatTest()
        {
            BeatInfo beatInfo = new BeatInfo();

            beatInfo.Port        = 5000;
            beatInfo.Ip          = "192.168.1.101";
            beatInfo.Weight      = 1;
            beatInfo.ServiceName = "tms_order_v1";
            beatInfo.Cluster     = "tms";
            beatInfo.MetaData.Add("k1", "v1");
            beatInfo.Scheduled = true;
            beatInfo.PerId     = 1000;
            beatInfo.Stopped   = false;

            var mockHttp = new MockHttpMessageHandler();
            var request  = mockHttp.When(HttpMethod.Put, _config.ServerAddr[0] + UtilAndComs.NACOS_URL_BASE + "/instance/beat")
                           .WithQueryString(NamingProxy.BEAT_KEY, beatInfo.ToString())
                           .WithQueryString(NamingProxy.NAMESPACE_ID_KEY, _config.Namespace)
                           .WithQueryString(NamingProxy.SERVICE_NAME_KEY, beatInfo.ServiceName)
                           .Respond("application/json", "ok");

            var proxy    = CreateProxy(mockHttp);
            var response = await proxy.SendBeat(beatInfo);

            Assert.Equal(1, mockHttp.GetMatchCount(request));
            Assert.Equal(0, response);
        }
    public void OnBeat(int c, BeatInfo beatInfo)
    {
        if (gameObject.activeInHierarchy)
        {
            var go = Instantiate(meteorPrefab).GetComponent <CMeteor>();
            go.musicSpeedFactor = musicSpeedFactor;

            // random x, y auf Einheitskreis
            float x, y;
            do
            {
                x = Random.value * 2 - 1;
                y = Random.value * 2 - 1;
            }while(Mathf.Sqrt(x * x + y * y) > 1);

            go.transform.position = refTransform.position
                                    + Vector3.right * x * spread
                                    + Vector3.up * y * spread;

            if (--count == 0)
            {
                clipController.SetActive(false);
                gameObject.SetActive(false);
            }
        }
    }
Beispiel #6
0
        private void InitBeatInfo()
        {
            if (_beatInfo == null)
            {
                _beatInfo = GlobalSystem._Instance._LoadingBeatInfo;
                if (_beatInfo == null && _TestInfo != null)
                {
                    // 목록으로부터 음악이 선택되지 않았다면 테스트용 정보 이용
                    _beatInfo = _TestInfo._BeatInfo;
                }
                if (_beatInfo == null)
                {
                    Debug.LogError("[GameSystem] Invalid BeatInfo");
                }
            }

            if (_logic == null)
            {
                _logic = Activator.CreateInstance(System.Type.GetType("Game." + _beatInfo._namespace + ".GameLogic")) as Game.BaseGameLogic;
                if (_logic == null)
                {
                    Debug.LogError("[GameSystem] Invalid namespcae:" + _beatInfo._namespace);
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// 添加心跳
        /// </summary>
        public void AddBeatInfo(string serviceName, BeatInfo beatInfo)
        {
            _logger.Info($"[BEAT] adding beat: {beatInfo} to beat map.");
            string key = BuildKey(serviceName, beatInfo.Ip, beatInfo.Port);

            _dom2beat.AddOrUpdate(key, beatInfo, (x, s) => beatInfo);
            Timer t = new Timer(async x =>
            {
                var state   = x as Tuple <BeatInfo, string>;
                Timer child = null;
                if (state.Item1.Stopped)
                {
                    return;
                }
                long result   = await _serverProxy.SendBeat(state.Item1);
                long nextTime = result > 0 ? result : state.Item1.PerId;

                if (_beatTimer.TryGetValue(BuildKey(state.Item2, state.Item1.Ip, state.Item1.Port), out child))
                {
                    child.Change(nextTime, Timeout.Infinite);
                }
            }, Tuple.Create(beatInfo, serviceName), Timeout.Infinite, Timeout.Infinite);

            _beatTimer.AddOrUpdate(key, t, (x, s) => t);

            t.Change(0, Timeout.Infinite);
        }
Beispiel #8
0
    // sort beats by spawn time
    public void SortBeats()
    {
        List <BeatInfo> newBeats = new List <BeatInfo>();

        foreach (BeatInfo beatInfo in beats.OrderBy(b => b.spawnTime))
        {
            bool addNewBeat = true;
            // if 2 beats are at the same position,
            // only add new one if if has priority
            if (newBeats.Any(b => b.beat == beatInfo.beat))
            {
                if (beatInfo.hasPriority)
                {
                    // remove old one
                    BeatInfo beatToRemove = newBeats.FirstOrDefault(b => b.beat == beatInfo.beat);
                    newBeats.Remove(beatToRemove);
                }
                else
                {
                    // don't add new one
                    addNewBeat = false;
                }
            }

            if (addNewBeat)
            {
                newBeats.Add(beatInfo);
            }
        }
        beats = newBeats;
    }
Beispiel #9
0
        public async Task RegisterServiceAsync(string serviceName, string groupName, Instance instance)
        {
            _logger?.LogInformation("[REGISTER-SERVICE] {0} registering service {1} with instance: {2}", namespaceId, serviceName, instance);

            string groupedServiceName = NamingUtils.GetGroupedName(serviceName, groupName);

            if (instance.Ephemeral)
            {
                BeatInfo beatInfo = beatReactor.BuildBeatInfo(groupedServiceName, instance);
                beatReactor.AddBeatInfo(groupedServiceName, beatInfo);
            }

            var paramters = new Dictionary <string, string>()
            {
                { CommonParams.NAMESPACE_ID, namespaceId },
                { CommonParams.SERVICE_NAME, groupedServiceName },
                { CommonParams.GROUP_NAME, groupName },
                { CommonParams.CLUSTER_NAME, instance.ClusterName },
                { "ip", instance.Ip },
                { "port", instance.Port.ToString() },
                { "weight", instance.Weight.ToString() },
                { "enable", instance.Enabled.ToString() },
                { "healthy", instance.Healthy.ToString() },
                { "ephemeral", instance.Ephemeral.ToString() },
                { "metadata", instance.Metadata.ToJsonString() },
            };

            await ReqApi(UtilAndComs.NacosUrlInstance, paramters, HttpMethod.Post);
        }
Beispiel #10
0
        public async Task RegisterServiceAsync(string serviceName, string groupName, Instance instance)
        {
            _logger?.LogInformation("[REGISTER-SERVICE] {0} registering service {1} with instance: {2}", namespaceId, serviceName, instance);

            string groupedServiceName = NamingUtils.GetGroupedName(serviceName, groupName);

            if (instance.Ephemeral)
            {
                BeatInfo beatInfo = beatReactor.BuildBeatInfo(groupedServiceName, instance);
                beatReactor.AddBeatInfo(groupedServiceName, beatInfo);
            }

            var paramters = new Dictionary <string, string>()
            {
                { CommonParams.NAMESPACE_ID, namespaceId },
                { CommonParams.SERVICE_NAME, groupedServiceName },
                { CommonParams.GROUP_NAME, groupName },
                { CommonParams.CLUSTER_NAME, instance.ClusterName },
                { CommonParams.IP_PARAM, instance.Ip },
                { CommonParams.PORT_PARAM, instance.Port.ToString() },
                { CommonParams.WEIGHT_PARAM, instance.Weight.ToString() },
                { CommonParams.ENABLE_PARAM, instance.Enabled.ToString() },
                { CommonParams.HEALTHY_PARAM, instance.Healthy.ToString() },
                { CommonParams.EPHEMERAL_PARAM, instance.Ephemeral.ToString() },
                { CommonParams.META_PARAM, instance.Metadata.ToJsonString() },
            };

            await ReqApi(UtilAndComs.NacosUrlInstance, paramters, HttpMethod.Post).ConfigureAwait(false);
        }
Beispiel #11
0
    public static HitTarget Create(BeatInfo beatinfo)
    {
        GameObject newTargetObj = Instantiate(Resources.Load("Prefabs/Hit Target")) as GameObject;
        HitTarget  newTarget    = newTargetObj.GetComponent <HitTarget>();

        newTarget.SetBeatInfo(beatinfo);
        return(newTarget);
    }
    private static void CreateBeatInfo()
    {
        string   path = "Assets/Resources/" + BeatInfo._resourcePath + "/NewBeatInfo.asset";
        BeatInfo info = ScriptableObject.CreateInstance <BeatInfo>();

        AssetDatabase.CreateAsset(info, path);
        Debug.Log("[BeatInfo] BeatInfo is created in " + path);
    }
Beispiel #13
0
 public void OnBeat(int c, BeatInfo beatInfo)
 {
     if (gameObject.activeInHierarchy)
     {
         if (--count == 0)
         {
             gameObject.SetActive(false);
         }
     }
 }
Beispiel #14
0
 public void SetData(BeatInfo beatInfo, bool cleared, int score, int highScore, bool isNewRecord)
 {
     _beatInfo       = beatInfo;
     _result.text    = cleared ? _resultClear : _resultGameOver;
     _songTitle.text = _beatInfo._title;
     _score.text     = score.ToString();
     _highScore.text = highScore.ToString();
     _newRecord.SetActive(isNewRecord);
     _leaderboard.interactable = (EGSocial._IsAuthenticated); // 로그인 되었을 때만 사용가능
 }
Beispiel #15
0
    // Use this for initialization
    void Start()
    {
        //set sorting layer
        sprite = GetComponent <SpriteRenderer>();
        if (sprite)
        {
            sprite.sortingLayerName = TARGET_LAYER;
        }
        else
        {
            Debug.Log("Error retrieving sprite layer.");
        }

        BeatInfo myBeatInfo = GetBeatInfo();
        Lane     myLane     = myBeatInfo.GetLane();

        switch (myLane)
        {
        case Lane.D:
            SetLane(GameObject.Find("d").GetComponent <InputReaction>());
            break;

        case Lane.F:
            SetLane(GameObject.Find("f").GetComponent <InputReaction>());
            break;

        case Lane.Space:
            SetLane(GameObject.Find("space").GetComponent <InputReaction>());
            break;

        case Lane.J:
            SetLane(GameObject.Find("j").GetComponent <InputReaction>());
            break;

        case Lane.K:
            SetLane(GameObject.Find("k").GetComponent <InputReaction>());
            break;

        default:
            break;
        }

        if (GetLane() != null)
        {
            SetXPos(GetLane().transform.position.x);
            GetLane().Enqueue(this);
        }
        else
        {
            Debug.Log("Couldn't find correct lane");
        }

        transform.position = new Vector3(GetXPos(), OFFSCREEN_Y, 0);
    }
Beispiel #16
0
        public void Animate(ScoreComponent score, BeatInfo beat)
        {
            if (beat.BeatNo % 2 != 0)
            {
                return;
            }
            var hue = Random.value;

            _currentAnimation = (_currentAnimation + 1) % _animationCount;
            _animations[_currentAnimation](hue);
        }
Beispiel #17
0
        public void Animate(ScoreComponent score, BeatInfo beat)
        {
            if (beat.BeatNo % 2 != 0)
            {
                return;
            }
            var hue = Random.value;

            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 7; j++)
                {
                    if (j % 2 == 0 && i % 2 == 0)
                    {
                        continue;
                    }
                    if (j % 2 == 1 && i % 2 == 1)
                    {
                        continue;
                    }
                    MessageBroker.Default.Publish(new ActLightUp
                    {
                        X          = i,
                        Y          = j,
                        FallOff    = 1f,
                        Delay      = 0,
                        BlinkColor = Color.HSVToRGB(hue, 1, 1),
                    });
                }
            }
            for (int i = 0; i < 7; i++)
            {
                for (int j = 0; j < 7; j++)
                {
                    if (j % 2 == 0 && i % 2 == 1)
                    {
                        continue;
                    }
                    if (j % 2 == 1 && i % 2 == 0)
                    {
                        continue;
                    }
                    MessageBroker.Default.Publish(new ActLightUp
                    {
                        X          = i,
                        Y          = j,
                        FallOff    = 1f,
                        Delay      = 0.5f,
                        BlinkColor = Color.HSVToRGB(hue, 1, 1),
                    });
                }
            }
        }
Beispiel #18
0
    /// <summary>
    /// 음악 리더보드 ID 구하기
    /// </summary>
    private static string GetSongLeaderboardID(BeatInfo beatInfo)
    {
        string key = ("leaderboard" + beatInfo._namespace);

        if (SocialSystem._Instance != null)
        {
            return(SocialSystem._Instance.GetGameID(key));
        }
        else
        {
            return(null);
        }
    }
Beispiel #19
0
        public void Animate(ScoreComponent score, BeatInfo beat)
        {
            var hue = Random.value;

            MessageBroker.Default.Publish(new ActLightUp
            {
                X          = Random.Range(0, 7),
                Y          = Random.Range(0, 7),
                FallOff    = 1.5f,
                Delay      = 0,
                BlinkColor = Color.HSVToRGB(hue, 1, 1),
            });
        }
Beispiel #20
0
        private void OnBeat(BeatInfo beatInfo, CameraColorComponent component)
        {
            if (beatInfo.BeatNo % 2 != 0)
            {
                return;
            }

            Color.RGBToHSV(component.TargetColor, out var h, out var s, out var v);
            h *= 360f;
            h  = (h + 481f) % 360f;
            h /= 360f;
            component.TargetColor = Color.HSVToRGB(h, 0.75f, 0.75f);
        }
 public void OnBeat(int c, BeatInfo beatInfo)
 {
     if (_type == GrowShrinkType.Alternate)
     {
         _currentType = _evenBeatCount ? GrowShrinkType.Grow : GrowShrinkType.Shrink;
     }
     else
     {
         _currentType = _type;
     }
     timer          = 0f;
     _evenBeatCount = !_evenBeatCount;
 }
Beispiel #22
0
    public void NoteHit(BeatType beatType)
    {
        if (!gameRunning)
        {
            return;
        }

        float    songPos  = AudioSource.time;
        BeatInfo beatInfo = GetCurrentBeat();
        Accuracy acc      = Accuracy.Miss; // guilty until proven innocent

        // 1. FIND TIME DIFFERENCE BETWEEN BEAT TIME AND ACTUAL TIME
        float timingDifference = Mathf.Abs(beatInfo.beat - songPos);

        // 2. CHECK IF NEXT BEAT IS CLOSE ENOUGH TO BOTHER CHECKING FOR ACCURACY
        if (timingDifference >= attemptWindow)
        {
            return;
        }

        // 3. FIGURE OUT IF CORRECT BUTTON WAS HIT
        if (beatType == beatInfo.beatType)
        {
            // 4. GET ACCURACY BASED ON TIME DIFFERENCE
            if (timingDifference <= accuracyOk && timingDifference > accuracyGreat)
            {
                acc = Accuracy.Ok;
            }
            else if (timingDifference <= accuracyGreat)
            {
                acc = Accuracy.Great;
            }

            //Debug.Log("current time: " + songPos + "; timing diff: " + timingDifference + "; accuracy: " + acc);
        }

        // 4. DISPLAY RESULTS
        UI.ShowAccuracy(acc);
        NoteController.NoteHit(beatInfo.beat);
        Score.NoteHit(acc);

        // animate dumpling if we hit the note!
        if (acc != Accuracy.Miss)
        {
            DumplingAnimator.IncrementFrame();
            NoteHitAudioSource.PlayOneShot(NoteHitClip, 1);
        }

        IncrementBeat();
    }
Beispiel #23
0
 public void OnBeat(int c, BeatInfo beatInfo)
 {
     // next loop started
     // _baseLine.AudioSource.time = 0;
     _currentLoopCounter++;
     if (_currentLoopCounter > _maxLoop)
     {
         _currentLoopCounter = 0;
     }
     foreach (ClipController clipController in _clipList)
     {
         clipController.OnLoop(_currentLoopCounter);
     }
 }
Beispiel #24
0
 public void OnBeat(int c, BeatInfo beatInfo)
 {
     if (gameObject.activeInHierarchy)
     {
         var go = Instantiate(meteorPrefab).GetComponent <CMeteor>();
         go.musicSpeedFactor   = musicSpeedFactor;
         go.transform.position = beatBoxTransform.position + beatBoxTransform.transform.up * Random.Range(1f, 5f);
         if (--count == 0)
         {
             clipController.SetActive(false);
             gameObject.SetActive(false);
         }
     }
 }
Beispiel #25
0
 public void OnBeat(int c, BeatInfo beatInfo)
 {
     if (gameObject.activeInHierarchy)
     {
         if (--_count <= 0)
         {
             _clipController.SetActive(false);
             gameObject.SetActive(false);
         }
         var go = Instantiate(_lasorPrefab).GetComponent <Lasor>();
         go.musicSpeedFactor   = _musicSpeedFactor;
         go.transform.position = _beatBoxTransform.position;
         go.transform.rotation = _beatBoxTransform.rotation;
     }
 }
Beispiel #26
0
        private void OnBeat(BeatInfo beatInfo, float timePerBeat)
        {
            if (_waitForBeatsCount-- > 0)
            {
                return;
            }

            EvtNextBeatKeyAdded[] keys = _currentGenerator
                                         .GenerateTargetsForBeat(beatInfo, timePerBeat, _keyInfoComponent.Value);

            foreach (var beatKeyAdded in keys)
            {
                MessageBroker.Default.Publish(beatKeyAdded);
            }
        }
Beispiel #27
0
        public Task UpdateBeatInfo(List <Instance> modifiedInstances)
        {
            foreach (var instance in modifiedInstances)
            {
                string key = beatReactor.BuildKey(instance.ServiceName, instance.Ip, instance.Port);

                if (beatReactor.Dom2Beat.ContainsKey(key) && instance.Ephemeral)
                {
                    BeatInfo beatInfo = beatReactor.BuildBeatInfo(instance);
                    beatReactor.AddBeatInfo(instance.ServiceName, beatInfo);
                }
            }

            return(Task.CompletedTask);
        }
Beispiel #28
0
        public void DrawChords()
        {
            double tempLeftMostTime = TL.LeftMostTime, tempRightMostTime = TL.RightMostTime;
            int    left = BeatEditor.GetPreviousBeatID(tempLeftMostTime) - 1, right = BeatEditor.GetNextBeatID(tempRightMostTime);

            // Get the previous of previous beat of the left bound and the next beat of the right bound.
            if (left < 0)
            {
                left = 0;
            }
            if (right >= Info.beats.Count)
            {
                right = Info.beats.Count - 1;
            }
            BeatInfo leftSameChord = Info.beats[left];

            for (int i = left; i <= right; ++i)
            {
                BeatInfo beat = Info.beats[i];
                if (beat.ChordTag?.ToString() != leftSameChord.ChordTag?.ToString() || i == right)
                {
                    DrawChordAt(leftSameChord, Info.beats[i]);
                    leftSameChord = beat;
                }
            }
            //Play chord parts
            if (AutoPlayMidi)
            {
                double curTime = TL.CurrentTime;
                pointLeftBeatID = BeatEditor.GetPreviousBeatID(curTime);
                if (pointLeftBeatID == -1)
                {
                    CurrentChord = null;
                }
                else
                {
                    Chord newChord = Info.beats[pointLeftBeatID].ChordTag;
                    if (CurrentChord?.ToString() != newChord?.ToString())
                    {
                        CurrentChord = newChord;
                        if (TL.Playing)
                        {
                            Program.MidiManager.PlayChordNotes(CurrentChord);
                        }
                    }
                }
            }
        }
Beispiel #29
0
        public BeatReactorTest()
        {
            _config = new NamingConfig
            {
                EndPoint   = "http://localhost:8848",
                ServerAddr = new List <string>()
                {
                    "http://localhost:8848"
                },
                Namespace = "vip56"
            };

            _mockHttp = new MockHttpMessageHandler();

            _orderBeatInfo             = new BeatInfo();
            _orderBeatInfo.Port        = 5000;
            _orderBeatInfo.Ip          = "192.168.1.50";
            _orderBeatInfo.Weight      = 1;
            _orderBeatInfo.ServiceName = "tms_order_v1";
            _orderBeatInfo.Cluster     = "tms";
            _orderBeatInfo.MetaData.Add("k1", "v1");
            _orderBeatInfo.Scheduled = true;
            _orderBeatInfo.PerId     = 500;
            _orderBeatInfo.Stopped   = false;

            _orderMockedRequest = _mockHttp.When(HttpMethod.Put, _config.ServerAddr[0] + UtilAndComs.NACOS_URL_BASE + "/instance/beat")
                                  .WithQueryString(NamingProxy.BEAT_KEY, _orderBeatInfo.ToString())
                                  .WithQueryString(NamingProxy.NAMESPACE_ID_KEY, _config.Namespace)
                                  .WithQueryString(NamingProxy.SERVICE_NAME_KEY, _orderBeatInfo.ServiceName)
                                  .Respond("application/json", "ok");

            _inquiryBeatInfo             = new BeatInfo();
            _inquiryBeatInfo.Port        = 5000;
            _inquiryBeatInfo.Ip          = "192.168.1.51";
            _inquiryBeatInfo.Weight      = 1;
            _inquiryBeatInfo.ServiceName = "tms_inquiry_v1";
            _inquiryBeatInfo.Cluster     = "tms";
            _inquiryBeatInfo.MetaData.Add("k2", "v2");
            _inquiryBeatInfo.Scheduled = true;
            _inquiryBeatInfo.PerId     = 500;
            _inquiryBeatInfo.Stopped   = false;

            _inquiryMockedRequest = _mockHttp.When(HttpMethod.Put, _config.ServerAddr[0] + UtilAndComs.NACOS_URL_BASE + "/instance/beat")
                                    .WithQueryString(NamingProxy.BEAT_KEY, _inquiryBeatInfo.ToString())
                                    .WithQueryString(NamingProxy.NAMESPACE_ID_KEY, _config.Namespace)
                                    .WithQueryString(NamingProxy.SERVICE_NAME_KEY, _inquiryBeatInfo.ServiceName)
                                    .Respond("application/json", "ok");
        }
Beispiel #30
0
        public void DrawBeatLine()
        {
            double tempLeftMostTime = TL.LeftMostTime, tempRightMostTime = TL.RightMostTime;
            int    left = GetNextBeatID(tempLeftMostTime), right = GetPreviousBeatID(tempRightMostTime);

            //foreach (BeatInfo beat in Info.beats)
            for (int i = left; i <= right; ++i)
            {
                BeatInfo beat = Info.beats[i];
                if (beat.Time >= tempLeftMostTime && beat.Time <= tempRightMostTime)
                {
                    int pos = TL.Time2Pos(beat.Time);
                    TL.G.DrawLine(whitePen, new Point(pos, TL.HorizonHeight), new Point(pos, TL.HorizonHeight - (beat.BarStart ? 10 : 7)));
                }
            }
        }