// Update is called once per frame
    void Update()
    {
        // If the player state is walking...
        if (playerState == PlayerState.walking)
        {
            Movement();

            // Enters the player into the Matching state
            if (Input.GetKeyDown(KeyCode.G))
            {
                Debug.Log("Type the Number of the player you want to Match. Press G again to cancel.");
                for (int i = 0; i < matchList.Length; i++)
                {
                    Debug.Log("" + (i + 1) + ". " + matchList[i].npcName + ": " + matchList[i].attribute);
                }
                playerState   = PlayerState.matching;
                matchingState = MatchingState.selection1;
            }
        }

        // If the player state is matching...
        else if (playerState == PlayerState.matching)
        {
            // Call the Match method
            Match();

            // If 'G' is pressed while matching, exit the matching process
            if (Input.GetKeyDown(KeyCode.G))
            {
                Debug.Log("Stopped Matching. Walk Around Now.");
                playerState   = PlayerState.walking;
                matchingState = MatchingState.notMatching;
            }
        }
    }
Example #2
0
        public Network()
        {
            _state         = MatchingState.IDLE;
            _connections   = new List <Connection>();
            _lockAnalyse   = new object();
            _recvBuffer    = new byte[0x20000];
            _logger        = Locator.Current.GetService <ILogger>();
            _packetHandler = Locator.Current.GetService <IPacketHandler>();

            RcvallIplevel = new byte[] { 3, 0, 0, 0 };
            _exePath      = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
        }
Example #3
0
    public void OnMatchingButtonClick(int matchMode)
    {
        Enums.MatchType matchType = (Enums.MatchType)matchMode;

        if (panelState == MatchingState.None)
        {
            photonLauncher.MatchingStart(matchType);
            buttonFolder.Fold();
            matchButton.GetComponent <UnityEngine.UI.Image>().sprite = matchButtonImgs[1];
            panelState = MatchingState.Matching;
        }

        SoundManager.instance.PlayEffect(Resources.Load <AudioClip>("Sounds/click3"));
    }
Example #4
0
    public void OnPlayButtonClick()
    {
        if (panelState == MatchingState.None)
        {
            buttonFolder.OnFoldButtonDown();
        }
        else
        {
            photonLauncher.MatchingCancel();
            matchButton.GetComponent <UnityEngine.UI.Image>().sprite = matchButtonImgs[0];
            panelState = MatchingState.None;
        }

        SoundManager.instance.PlayEffect(Resources.Load <AudioClip>("Sounds/click3"));
    }
Example #5
0
    void Start()
    {
        DontDestroyOnLoad(gameObject);
        userInfo = GameObject.Find("DataObject").GetComponent <UserInfo>();
        Debug.Log(userInfo.userAchieveData.ToString());
        Debug.Log(userInfo.userPlayData.ToString());
        userInfoFlag = false;

        // 현재 매치메이킹 진행 state 초기화
        matchingState = MatchingState.Nothing;

        networkManager = GetComponent <MatchingNetworkManager>();
        networkManager.RegisterReceiveNotification(PacketId.MatchingResponse,
                                                   OnReceiveMatchingResponsePacket);
        networkManager.RegisterReceiveNotification(PacketId.MatchingRetry,
                                                   OnReceiveMatchingRetryPacket);
        networkManager.RegisterReceiveNotification(PacketId.MatchingReject,
                                                   OnReceiveMatchingRejectPacket);
        networkManager.RegisterReceiveNotification(PacketId.MatchingComplete,
                                                   OnReceiveMatchingCompletePacket);
    }
Example #6
0
    private void Start()
    {
        if (PhotonManager.Instance.IsVisiableOpenButton())
        {
            openButtonObj.SetActive(true);
        }
        else
        {
            openButtonObj.SetActive(false);
        }
        userName = PlayerDataManager.Instance.UserName;
        playerId = PhotonManager.Instance.PlayerId;
        MatchingState matchingState = new MatchingState();

        if (PhotonManager.Instance.NowConnectType != ConnectType.RandomJoin)
        {
            RoomNameBg.SetActive(true);
            RoomNameText.text = PhotonManager.Instance.RoomName;
        }
        playerCells[0].InitPlayerCell(PhotonNetwork.player.NickName, (PlayerType)PhotonNetwork.player.CustomProperties["PlayerType"]);
        setupEvent();
    }
Example #7
0
        public void ShowMatching(MatchingState ms, double similarity)
        {
            switch(ms)
            {
                case MatchingState.Unknown:
                    lbReconcileResult.Text = "";
                    lbReconcileResult.BackColor = Color.White;
                    lbReconcileResult.ForeColor = Color.Yellow;
                    break;
                case MatchingState.Linked:
                    lbReconcileResult.Text = "Linked";
                    lbReconcileResult.BackColor = Color.Blue;
                    lbReconcileResult.ForeColor = Color.Yellow;
                    break;
                case MatchingState.Match:
                    lbReconcileResult.Text = "Match";
                    lbReconcileResult.BackColor = Color.DarkGreen;
                    lbReconcileResult.ForeColor = Color.Yellow;
                    break;
                case MatchingState.NoMatch:
                    lbReconcileResult.Text = "No match";
                    lbReconcileResult.BackColor = Color.Red;
                    lbReconcileResult.ForeColor = Color.Yellow;
                    break;
                case MatchingState.LinkedToOther:
                    lbReconcileResult.Text = "OtherLinked";
                    lbReconcileResult.BackColor = Color.Red;
                    lbReconcileResult.ForeColor = Color.Yellow;
                    break;
                case MatchingState.Similar:
                    lbReconcileResult.Text = "Similar";
                    lbReconcileResult.BackColor = Color.FromArgb(0, (int)(127 * (2.0 - similarity)), 0);
                    lbReconcileResult.ForeColor = Color.Yellow;
                    break;
                default:
                    throw new Exception("Bad params");
            }
            lbReconcileSimilarity.Text = similarity.ToString("F1");

        }
 // Use this for initialization
 void Start()
 {
     matchList     = new AtomNPC[4];
     playerState   = PlayerState.walking;
     matchingState = MatchingState.notMatching;
 }
    // This method matches two NPCs of the player's choice
    // It also gives them a score out of 4 on the match (To be flushed out later)
    private void Match()
    {
        // First step in matching, choose the first matchee with the number keys
        if (matchingState == MatchingState.selection1)
        {
            if (Input.GetKeyDown(KeyCode.Keypad1) || Input.GetKeyDown(KeyCode.Alpha1))
            {
                Debug.Log("Type the Number of the player you want to Match. Press G to cancel.");
                firstMatchChoice = matchList[0];
                ShowSecondMatchChoices(0);
                matchingState = MatchingState.selection2;
            }
            if (Input.GetKeyDown(KeyCode.Keypad2) || Input.GetKeyDown(KeyCode.Alpha2))
            {
                Debug.Log("Type the Number of the player you want to Match. Press G to cancel.");
                firstMatchChoice = matchList[1];
                ShowSecondMatchChoices(1);
                matchingState = MatchingState.selection2;
            }
            if (Input.GetKeyDown(KeyCode.Keypad3) || Input.GetKeyDown(KeyCode.Alpha3))
            {
                Debug.Log("Type the Number of the player you want to Match. Press G to cancel.");
                firstMatchChoice = matchList[2];
                ShowSecondMatchChoices(2);
                matchingState = MatchingState.selection2;
            }
            if (Input.GetKeyDown(KeyCode.Keypad4) || Input.GetKeyDown(KeyCode.Alpha4))
            {
                Debug.Log("Type the Number of the player you want to Match. Press G to cancel.");
                firstMatchChoice = matchList[3];
                ShowSecondMatchChoices(3);
                matchingState = MatchingState.selection2;
            }
        }

        // Second part of matching, choose the second person
        else if (matchingState == MatchingState.selection2)
        {
            if (Input.GetKeyDown(KeyCode.Keypad1) || Input.GetKeyDown(KeyCode.Alpha1))
            {
                // Call the choice Match Method
                int matchGrade1     = firstMatchChoice.CheckMatch(matchList[0]);
                int matchGrade2     = matchList[0].CheckMatch(firstMatchChoice);
                int matchGradeFinal = matchGrade1 + matchGrade2;
                Debug.Log("Your grade for matching " + firstMatchChoice.npcName + " and " + matchList[0].npcName + " is " + matchGradeFinal.ToString() + "/4");

                // Remove them from THE LIST
                playerState   = PlayerState.walking;
                matchingState = MatchingState.notMatching;
            }
            if (Input.GetKeyDown(KeyCode.Keypad2) || Input.GetKeyDown(KeyCode.Alpha2))
            {
                // Call the choice Match Method
                int matchGrade1     = firstMatchChoice.CheckMatch(matchList[1]);
                int matchGrade2     = matchList[1].CheckMatch(firstMatchChoice);
                int matchGradeFinal = matchGrade1 + matchGrade2;
                Debug.Log("Your grade for matching " + firstMatchChoice.npcName + " and " + matchList[1].npcName + " is " + matchGradeFinal.ToString() + "/4");

                // Remove them from THE LIST
                playerState   = PlayerState.walking;
                matchingState = MatchingState.notMatching;
            }
            if (Input.GetKeyDown(KeyCode.Keypad3) || Input.GetKeyDown(KeyCode.Alpha3))
            {
                // Call the choice Match Method
                int matchGrade1     = firstMatchChoice.CheckMatch(matchList[2]);
                int matchGrade2     = matchList[2].CheckMatch(firstMatchChoice);
                int matchGradeFinal = matchGrade1 + matchGrade2;
                Debug.Log("Your grade for matching " + firstMatchChoice.npcName + " and " + matchList[2].npcName + " is " + matchGradeFinal.ToString() + "/4");

                // Remove them from THE LIST
                playerState   = PlayerState.walking;
                matchingState = MatchingState.notMatching;
            }
            if (Input.GetKeyDown(KeyCode.Keypad4) || Input.GetKeyDown(KeyCode.Alpha4))
            {
                // Call the choice Match Method
                int matchGrade1     = firstMatchChoice.CheckMatch(matchList[3]);
                int matchGrade2     = matchList[3].CheckMatch(firstMatchChoice);
                int matchGradeFinal = matchGrade1 + matchGrade2;
                Debug.Log("Your grade for matching " + firstMatchChoice.npcName + " and " + matchList[3].npcName + " is " + matchGradeFinal.ToString() + "/4");

                // Remove them from THE LIST
                playerState   = PlayerState.walking;
                matchingState = MatchingState.notMatching;
            }
        }
    }
Example #10
0
        public void Analyze(int processId, byte[] payload, ref MatchingState state)
        {
            try
            {
                while (true)
                {
                    if (payload.Length < 4)
                    {
                        break;
                    }

                    var type = BitConverter.ToUInt16(payload, 0);
                    if (type == 0x0000 || type == 0x5252)
                    {
                        if (payload.Length < 28)
                        {
                            break;
                        }

                        var length = BitConverter.ToInt32(payload, 24);
                        if (length <= 0 || payload.Length < length)
                        {
                            break;
                        }

                        using (var messages = new MemoryStream(payload.Length))
                        {
                            using (var stream = new MemoryStream(payload, 0, length))
                            {
                                stream.Seek(40, SeekOrigin.Begin);

                                if (payload[33] == 0x00)
                                {
                                    stream.CopyTo(messages);
                                }
                                else
                                {
                                    // .Net DeflateStream Bug (Force the previous 2 bytes)
                                    stream.Seek(2, SeekOrigin.Current);
                                    using (var z = new DeflateStream(stream, CompressionMode.Decompress))
                                    {
                                        z.CopyTo(messages);
                                    }
                                }
                            }

                            messages.Seek(0, SeekOrigin.Begin);

                            var messageCount = BitConverter.ToUInt16(payload, 30);
                            for (var i = 0; i < messageCount; i++)
                            {
                                try
                                {
                                    var buffer = new byte[4];
                                    var read   = messages.Read(buffer, 0, 4);
                                    if (read < 4)
                                    {
                                        _logger.Write(
                                            $"A: Length Error while analyzing Message: {read} {i}/{messageCount}",
                                            LogLevel.Error);
                                        break;
                                    }

                                    var messageLength = BitConverter.ToInt32(buffer, 0);

                                    var message = new byte[messageLength];
                                    messages.Seek(-4, SeekOrigin.Current);
                                    messages.Read(message, 0, messageLength);

                                    HandleMessage(processId, message, ref state);
                                }
                                catch (Exception ex)
                                {
                                    _logger.Write(ex, "A: Error while analyzing Message", LogLevel.Error);
                                }
                            }
                        }

                        if (length < payload.Length)
                        {
                            // Packets still need to be processed
                            payload = payload.Skip(length).ToArray();
                            continue;
                        }
                    }
                    else
                    {
                        // Forward-Cut packet workaround
                        // Discard one truncated packet and find just the next packet
                        for (var offset = 0; offset < payload.Length - 2; offset++)
                        {
                            var possibleType = BitConverter.ToUInt16(payload, offset);
                            if (possibleType != 0x5252)
                            {
                                continue;
                            }

                            payload = payload.Skip(offset).ToArray();
                            Analyze(processId, payload, ref state);
                            break;
                        }
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                _logger.Write(ex, "A: Error while handling Message", LogLevel.Error);
            }
        }
Example #11
0
        private void HandleMessage(int pid, byte[] message, ref MatchingState state)
        {
            try
            {
                if (message.Length < 32)
                {
                    // type == 0x0000 (Messages were filtered here)
                    return;
                }

                var opcode = BitConverter.ToUInt16(message, 18);

#if !DEBUG
                if (opcode != 0x0078 &&
                    opcode != 0x0079 &&
                    opcode != 0x0080 &&
                    opcode != 0x006C &&
                    opcode != 0x006F &&
                    opcode != 0x0121 &&
                    opcode != 0x0143 &&
                    opcode != 0x022F)
                {
                    return;
                }
#endif
                var data = message.Skip(32).ToArray();
                if (opcode == 0x022F) // Entering/Leaving an instance
                {
                    var code = BitConverter.ToInt16(data, 4);
                    if (code == 0)
                    {
                        return;
                    }

                    var type = data[8];

                    if (type == 0x0B)
                    {
                        _logger.Write($"I: Entered Instance Area [{code}] - {_dataRepository.GetInstance(code).Name}", LogLevel.Debug);
                    }
                    else if (type == 0x0C)
                    {
                        _logger.Write($"I: Left Instance Area [{code}] - {_dataRepository.GetInstance(code).Name}", LogLevel.Debug);
                    }
                }
                else if (opcode == 0x008F) // Duties
                {
                    var status = data[0];
                    var reason = data[4];

                    if (status == 0) // Apply for Duties
                    {
                        _netCompatibility = false;
                        state             = MatchingState.QUEUED;

                        _rouletteCode = data[8];

                        if (_rouletteCode != 0 && (data[15] == 0 || data[15] == 64)
                            ) // Roulette, on Korean Server || on Global Server
                        {
                            _logger.Write($"Q: Duty Roulette Matching Started [{_rouletteCode}] - {_dataRepository.GetRoulette(_rouletteCode).Name}", LogLevel.Debug);
                        }
                        else // Specific Duty (Dungeon/Trial/Raid)
                        {
                            _logger.Write("Q: Matching started for duties: ", LogLevel.Debug);
                            for (var i = 0; i < 5; i++)
                            {
                                var code = BitConverter.ToUInt16(data, 12 + i * 4);
                                if (code == 0)
                                {
                                    break;
                                }

                                _logger.Write($" {i}. [{code}] - {_dataRepository.GetInstance(code).Name}", LogLevel.Debug);
                            }
                        }
                    }

                    /*else if (status == 3) // Cancel
                     * {
                     *  state = reason == 8 ? MatchingState.QUEUED : MatchingState.IDLE;
                     *  _logger.Write("Q: Matching Stopped", LogLevel.Debug);
                     * }
                     * else if (status == 6) // Entered
                     * {
                     *  state = MatchingState.IDLE;
                     *  _logger.Write("Q: Entered Instance Area", LogLevel.Debug);
                     * }
                     * else if (status == 4) // Matched
                     * {
                     *  var roulette = data[20];
                     *  var code = BitConverter.ToUInt16(data, 22);
                     *  if(code == 0)
                     *      return;
                     *
                     *  state = MatchingState.MATCHED;
                     *  FireEvent(pid, EventType.MATCH_ALERT, new int[] { roulette, code });
                     *
                     *  _logger.Write($"Q: Matched [{roulette} - - {_dataRepository.GetInstance(code).Name}] - [{code} - {_dataRepository.GetInstance(code).Name}]", LogLevel.Info);
                     * }*/
                }
                else if (opcode == 0x00B3)
                {
                    var roulette = _rouletteCode;
                    var code     = BitConverter.ToUInt16(data, 20);

                    state = MatchingState.MATCHED;
                    FireEvent(pid, EventType.MATCH_ALERT, new int[] { roulette, code });

                    _logger.Write($"Q: Matched [{roulette} - - {_dataRepository.GetInstance(code).Name}] - [{code} - {_dataRepository.GetInstance(code).Name}]", LogLevel.Info);
                }
                else if (opcode == 0x006F)
                {
                    // used on standalone version to stop blink
                }
                else if (opcode == 0x0121)
                {
                    // used on standalone version to stop blink, for Global Server
                }
                else if (opcode == 0x0304) // Status during matching
                {
                    var code = BitConverter.ToUInt16(data, 0);
                    if (code == 0)
                    {
                        return;
                    }

                    var instance  = _dataRepository.GetInstance(code);
                    var order     = data[6];
                    var waitTime  = data[7];
                    var tank      = data[8];
                    var tankMax   = data[9];
                    var healer    = data[10];
                    var healerMax = data[11];
                    var dps       = data[12];
                    var dpsMax    = data[13];



                    var member = tank * 10000 + dps * 100 + healer;

                    if (state == MatchingState.MATCHED && _lastMember != member)
                    {
                        // We get here when the queue is stopped by someone else (?)
                        state = MatchingState.QUEUED;
                    }
                    else if (state == MatchingState.IDLE)
                    {
                        // Plugin started with duty finder in progress
                        state = MatchingState.QUEUED;
                    }
                    else if (state == MatchingState.QUEUED)
                    {
                        // in queue
                    }

                    _lastMember = member;


                    var memberinfo = $"{tank}/{instance.Tank}, {healer}/{instance.Healer}, {dps}/{instance.Dps} | {member}";
                    _logger.Write($"Q: Matching State Updated [{instance.Name}, {memberinfo}]", LogLevel.Debug);
                }
                else if (opcode == 0x0080)
                {
                    var roulette = data[2];
                    var code     = BitConverter.ToUInt16(data, 4);

                    state = MatchingState.MATCHED;
                    FireEvent(pid, EventType.MATCH_ALERT, new int[] { roulette, code });

                    _logger.Write($"Q: Matched [{code}] - {_dataRepository.GetInstance(code).Name}", LogLevel.Info);
                }
            }
            catch (Exception ex)
            {
                _logger.Write(ex, "A: Error while analyzing Message", LogLevel.Error);
            }
        }
Example #12
0
 private void ChangeMatchingState(MatchingState st)
 {
     matchingState = st;
 }
        public override IList<PickingResult> DoPicking(StrategyConfig conf, Stock sto, IList<KJapaneseData> kdatas
		    	, IList<KTrendMAShort> masList, IList<KTrendMALong> malList, IList<KTrendVMALong> vmalList)
        {
            decimal amOpenClose = conf.GetDecimal("AM-Open-Close");
            decimal amMinMax = conf.GetDecimal("AM-Min-Max");
            decimal amPrev = conf.GetDecimal("AM-Prev");
            decimal amMatchedDays = conf.GetDecimal("AM-Matched-Days");
            int minMatchedDays = conf.GetInt("Min-Matched-Days");
            int startingPoint = conf.GetInt("Starting-Point");

            decimal value1 = 0, value2 = 0 ;
            //微观价格条件匹配
            MatchingState state = new MatchingState();
            for(int i=kdatas.Count-1; i>0; i--){
                //价格为0无法计算,退出
                if(kdatas[i].OpenPrice==0 || kdatas[i].LowPrice==0 || kdatas[i].ClosePrice==0) {
                    log.Info(sto.StockCode + ": on " + kdatas[i].TxDate.ToString("yyyyMMdd")
                             + "(open=" + kdatas[i].OpenPrice.ToString("f2") + ", max=" + kdatas[i].HighPrice.ToString("f2")
                             + ", min=" + kdatas[i].LowPrice.ToString("f2") + ", close=" + kdatas[i].ClosePrice.ToString("f2")
                             + ", prev=" + kdatas[i].PrevPrice.ToString("f2") + "), can't apply CrossStartLineStrategy");
                    break;
                }
                if(amOpenClose>0){ //开盘、收盘价振幅条件
                    value1 = (kdatas[i].ClosePrice - kdatas[i].OpenPrice) / kdatas[i].OpenPrice;
                    if(Math.Abs(value1) > amOpenClose) {
                        StopMatching(state, minMatchedDays);
                        if( (kdatas.Count-1) - i + 1 >= startingPoint) break;
                        continue;
                    }
                }
                if(amMinMax>0){ //最高价、最低价振幅条件
                    value1 = (kdatas[i].HighPrice - kdatas[i].LowPrice) / kdatas[i].LowPrice;
                    if(value1 > amMinMax) {
                        StopMatching(state, minMatchedDays);
                        if( (kdatas.Count-1) - i + 1 >= startingPoint) break;
                        continue;
                    }
                }
                if(state.MatchedCount<=0){
                    //还未匹配到任何节点,而单日条件已经判断完毕,则将该节点视作第一个满足条件的节点
                    state.MatchOne(i, kdatas[i]);
                    continue;
                }
                if(amPrev>0){ //相邻交易日收盘价振幅条件
                    //因为执行到此,state.MatchedCount>0必然成立,因此可以确保kdatas[i+1]不会越界
                    value1 = (kdatas[i+1].ClosePrice - kdatas[i].ClosePrice) / kdatas[i].ClosePrice;
                    if(Math.Abs(value1) > amPrev){
                        //这里不符合条件,是指已匹配节点与当前节点相邻日期间振幅不满足条件,因此对已匹配节点进行截止操作
                        //而当前节点仍然是一个新的、有效的终止点
                        StopMatching(state, minMatchedDays);
                        if( (kdatas.Count-1) - i + 1 >= startingPoint) break;
                        state.MatchOne(i, kdatas[i]);
                        continue;
                    }
                }
                if(amMatchedDays>0) { //所有已匹配节点收盘价振幅条件
                    if(kdatas[i].ClosePrice<state.MinClose || kdatas[i].ClosePrice>state.MaxClose){
                        value1 = kdatas[i].ClosePrice < state.MinClose ? kdatas[i].ClosePrice : state.MinClose;
                        value2 = kdatas[i].ClosePrice > state.MaxClose ? kdatas[i].ClosePrice : state.MaxClose;
                        if( (value2 - value1) / value1 > amMatchedDays){
                            StopMatching(state, minMatchedDays);
                            if( (kdatas.Count-1) - i + 1 >= startingPoint) break;
                            state.MatchOne(i, kdatas[i]); //备注说明同amPrev
                            continue;
                        }
                    }
                }
                state.MatchOne(i, kdatas[i]);
            }
            StopMatching(state, minMatchedDays);

            if(state.MatchedList.Count>0){
                //成交量趋势匹配
                foreach(MatchingState s in state.MatchedList){
                    KTrendVMALong vma = base.FindMAData<KTrendVMALong>(vmalList, kdatas[s.StartIndex].TxDate, false);
                    if(vma==null) continue;
                    s.VolReduction = vma.EndValue < vma.StartValue;
                    decimal vol = 0;
                    for(int i=s.StartIndex; i<=s.EndIndex; i++){
                        vol += kdatas[i].Volume;
                    }
                    KJapaneseData volTopData = base.FindKData(kdatas, vma.StartDate);
                    s.VolRatio = (vol / s.MatchedCount) / volTopData.VMAShort;
                    s.VolPrevTopDate = volTopData.TxDate;
                }

                //后续价格走势匹配
                foreach(MatchingState s in state.MatchedList){
                    KTrendMAShort mas = base.FindMAData<KTrendMAShort>(masList, kdatas[s.EndIndex].TxDate, true);
                    if(mas!=null){
                        s.MAShortInc = mas.EndValue > mas.StartValue;
                        s.MAShortTopDate = mas.EndDate;
                        s.MAShortRatio = (base.FindKData(kdatas, mas.EndDate).MAShort - kdatas[s.EndIndex].ClosePrice) / kdatas[s.EndIndex].ClosePrice;
                    }
                    KTrendMALong mal = base.FindMAData<KTrendMALong>(malList, kdatas[s.EndIndex].TxDate, true);
                    if(mal!=null){
                        s.MALongInc = mal.EndValue > mal.StartValue;
                        s.MALongTopDate = mal.EndDate;
                        s.MALongRatio = (base.FindKData(kdatas, mal.EndDate).MAShort - kdatas[s.EndIndex].ClosePrice) / kdatas[s.EndIndex].ClosePrice;
                    }
                }
            }

            IList<PickingResult> result = new List<PickingResult>();
            foreach(MatchingState s in state.MatchedList){
                result.Add(new PickingResult(){
                    StockId = sto.StockId,
                    StartDate = kdatas[s.StartIndex].TxDate,
                    EndDate = kdatas[s.EndIndex].TxDate,
                    TxDays = s.MatchedCount,
                    VolDec = s.VolReduction,
                    VolNetChange = s.VolRatio,
                    VolTopDate = s.VolPrevTopDate,
                    MAShortInc = s.MAShortInc,
                    MAShortNetChange = s.MAShortRatio,
                    MAShortTopDate = s.MAShortTopDate,
                    MALongInc = s.MALongInc,
                    MALongNetChange = s.MALongRatio,
                    MALongTopDate = s.MALongTopDate
                });
            }
            return result;
        }
 public MatchingState(MatchingState target)
 {
     this.MatchedCount = target.MatchedCount;
     this.StartIndex = target.StartIndex;
     this.EndIndex = target.EndIndex;
     this.MaxClose = target.MaxClose;
     this.MinClose = target.MinClose;
     this.VolReduction = target.VolReduction;
     this.VolRatio = target.VolRatio;
 }
 private void StopMatching(MatchingState state, int minDays)
 {
     if(state.MatchedCount>=minDays) state.PushMatched();
     state.Reset();
 }