Ejemplo n.º 1
0
 public void SetTask(CollectType collectType, EnvironmentCreate environmentCreate, Transform commender)
 {
     this.collectType       = collectType;
     this.environmentCreate = environmentCreate;
     this.commender         = commender;
     FSM.SetState(new NPCFindCollect(FSM));
 }
Ejemplo n.º 2
0
    public Collectable CreateCollectable(CollectType t)
    {
        GameObject pref = null;

        switch (t)
        {
        case CollectType.Fruit:
            pref = (Level_Collects.Fruit.Get() as GameObject);
            break;

        case CollectType.FruitBad:
            pref = (Level_Collects.FruitBad.Get() as GameObject);
            break;

        case CollectType.Bomb:
            pref = (Level_Collects.Bomb.Get() as GameObject);
            break;

        case CollectType.Coin:
            pref = (Level_Collects.Coin.Get() as GameObject);
            break;
        }

        if (pref != null)
        {
            return(pref.GetComponent <Collectable>());
        }
        return(null);
    }
Ejemplo n.º 3
0
 public bool isDone;             // 是否采集完成
 public CollectData(CollectType collectType, float maxTime, float remainingTime, int number, bool isDone)
 {
     this.collectType   = collectType;
     this.maxTime       = maxTime;
     this.remainingTime = remainingTime;
     this.number        = number;
     this.isDone        = isDone;
 }
 public Collectable(Texture2D texture, Vector2 position, float speed, CollectType type)
 {
     this.collectTexture = texture;
     this.collectPosition = position;
     //we need to calculate the speed of the collectable movement for the same speed of the background
     this.collectDefaultSpeed = speed / 60;
     this.collectScrollSpeed = collectDefaultSpeed;
     this.collectType = type;
     this.collectOffset = new Vector2(collectTexture.Width, collectTexture.Height) / 2.0f;
 }
Ejemplo n.º 5
0
    public CollectQuest(CollectType type, int collectAmount, string description, int goldReward, int expReward, Inventory itemReward) {
        this.type = type;
        this.collectCount = collectAmount;

        base.questID = GameConstants.getPlayerStats().questSystem.questID++;
        base.description = description;
        base.goldReward = goldReward;
        base.expReward = expReward;
        base.itemReward = itemReward;
    }
Ejemplo n.º 6
0
        /// <summary>
        /// Iterate the current shapes collecting their transforms (for rendering).
        /// </summary>
        /// <param name="transforms">List to populate with shape transforms.</param>
        /// <param name="parentTransforms">List to populate with parent transforms.</param>
        /// <param name="shapes">List of shapes collected</param>
        /// <param name="collectType">Defines what kind of shapes to collect.</param>
        /// <remarks>
        /// This method is used to collect shapes for rendering, collecting each valid shape's transform, parent transform
        /// and core shape data in the relevant lists.
        /// </remarks>
        public void Collect(List <Matrix4x4> transforms, List <Matrix4x4> parentTransforms,
                            List <CreateMessage> shapes, CollectType collectType)
        {
            // Walk the _headers and _transforms arrays directly. We can tell which indices are valid by investigating the
            // _headers[].ID value. A zero value is not in use.
            // TODO: (KS) consider storing a high water mark to limit iterating the arrays.
            bool transientCache = IsTransientCache;
            int  itemLimit      = (transientCache) ? _currentCount : _capacity;

            for (int i = 0; i < itemLimit; ++i)
            {
                CreateMessage shape = _shapes[i];

                // Transient cached we know everything up to the item limit is valid. All IDs will be zero.
                // Non transient cache, we look for shapes with non-Render IDs.
                // A transient cache has all IDs set to zero. A non-transient cache has all valid IDs as non-zero.
                if ((transientCache || shape.ObjectID != 0))
                {
                    bool add = false;
                    // Don't visualise multi-shape entries; they are essentially the parent transform for a set of other shapes
                    // not bearing this flag.
                    if ((shape.Flags & (ushort)Tes.Net.ObjectFlag.MultiShape) == 0)
                    {
                        if ((shape.Flags & (ushort)Tes.Net.ObjectFlag.Wireframe) != 0)
                        {
                            // Collecting wireframe.
                            add = collectType == CollectType.Wireframe;
                        }
                        else if ((shape.Flags & (ushort)Tes.Net.ObjectFlag.Transparent) != 0)
                        {
                            // Collecting transparent.
                            add = collectType == CollectType.Transparent;
                        }
                        else if (collectType == CollectType.Solid)
                        {
                            // Collecting solid.
                            add = true;
                        }
                    }

                    if (add)
                    {
                        transforms.Add(_transforms[i]);
                        parentTransforms.Add(_parentTransforms[i]);
                        shapes.Add(shape);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 字符串转换为枚举类型
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        private CollectType GetCollectType(string code)
        {
            code.CheckNotNullOrEmpty("code");
            Type type = typeof(CollectType);

            MemberInfo[] members = type.GetMembers(BindingFlags.Public | BindingFlags.Static);
            foreach (MemberInfo member in members)
            {
                CollectType collectType = member.Name.CastTo <CollectType>();
                if (collectType.ToString() == code)
                {
                    return(collectType);
                }
            }
            throw new NotSupportedException("不支持的收藏类型" + code);
        }
    // Use this for initialization
    void Start()
    {
        switch (this.gameObject.tag)
        {
        case ("Fish"):
            ct = CollectType.Fish;
            break;

        case ("Refugee"):
            ct = CollectType.Refugee;
            break;

        default:
            ct = CollectType.Fish;
            break;
        }
    }
Ejemplo n.º 9
0
    public void refreshQuestSystem(KillType? killType, CollectType? collectType) {

        if(killType != null) {
            Debug.Log("Add Kill");
            killCounter.addNewKill((KillType)killType);
        }

        if(collectType != null) {
            Debug.Log("Add Collect");
            collectCounter.addNewCollect((CollectType)collectType);
        }

        foreach(Quest q in questList) {
            if (!q.isQuestSolved()) {
                q.onQuestRefresh();
            }
        }
    }
Ejemplo n.º 10
0
    static SongObject ParseOSU(TextAsset textAsset, string fileName)
    {
        SongObject  songObj      = new SongObject();
        CollectType _collectType = CollectType.General;

        string[] contents = textAsset.text.Split('\n');
        Dictionary <string, string> result = new Dictionary <string, string> ();

        result.Add("Title:", fileName);

        List <HitObject> tmpHitObject = new List <HitObject> ();
        int  k = 0;
        bool nextSentenceAheadIn = false;
        bool streamSentenceEdit  = false;


        for (int i = 0; i < contents.Length; i++)
        {
            string oneLine = contents[i].Trim();

            //空行和注释行 不解析
            if (string.IsNullOrEmpty(oneLine) || oneLine.StartsWith("//", StringComparison.Ordinal))
            {
                continue;
            }

            if (oneLine.Contains("[HitObjects]"))
            {
                _collectType = CollectType.HitObject;
                continue;
            }
            if (oneLine.Contains("[SentenceInfo]"))
            {
                _collectType = CollectType.SentenceInfo;
                continue;
            }

            switch (_collectType)
            {
            case CollectType.General:
                for (int j = 0; j < m_Fields.Length; j++)
                {
                    if (oneLine.Contains(m_Fields[j]))
                    {
                        result.Add(m_Fields[j], oneLine.Replace(m_Fields[j], ""));
                    }
                }
                break;

            case CollectType.SentenceInfo:
                if (!streamSentenceEdit)
                {                        //
                    #region 普通句子
                    SentenceObj sentenceobjs = new SentenceObj();

                    if (oneLine.Contains("@@VoiceStart"))
                    {
                        sentenceobjs.Type = SentenceType.KeyVoiceStart;
                        string[]  stringArray   = oneLine.Split(',');
                        int       sentenceStart = int.Parse(stringArray[1]);
                        InOutTime inOut         = new InOutTime(sentenceStart, sentenceStart);
                        sentenceobjs.m_InOutTime = inOut;
                        songObj.SentenceObjs.Add(sentenceobjs);
                        _collectType = CollectType.KeyAndVoice;
                        // LogManager.Log(oneLine , "     ///  _collectType = CollectType.KeyAndVoice");
                        continue;
                    }

                    if (oneLine.Contains("@@"))
                    {
                        sentenceobjs.Type = SentenceType.BossStart;
                        string[] stringArray = oneLine.Replace("@@", "").Split(',');
                        if (stringArray.Length != 2)
                        {
                            LogManager.LogError("boss战起始时间和延迟播放音乐配置错误");
                        }
                        int       sentenceStart = int.Parse(stringArray[0]);
                        int       musicDelay    = int.Parse(stringArray[1]);
                        InOutTime inOut         = new InOutTime(sentenceStart, sentenceStart);
                        sentenceobjs.m_InOutTime  = inOut;
                        songObj.BossWarMusicDelay = musicDelay;
                        streamSentenceEdit        = true;
                        songObj.SentenceObjs.Add(sentenceobjs);
                        continue;
                    }


                    string[] parse     = oneLine.Split(',');
                    int      startTime = int.Parse(parse[0]);
                    int      endTime   = int.Parse(parse[1]);


                    if (parse[2].Contains("#"))
                    {
                        sentenceobjs.Type = SentenceType.Voice;
                        parse[2]          = parse[2].Replace("#", "");
                    }
                    else
                    {
                        sentenceobjs.Type = SentenceType.Common;
                    }

                    string[] param         = parse[2].Split('$');
                    string[] wordShow      = parse[3].Split('$');
                    string[] wordSoundFile = null;
                    if (parse.Length >= 5)
                    {
                        wordSoundFile = parse[4].Split('$');
                    }
                    for (int j = 0; j < param.Length; j++)
                    {
                        if (k >= tmpHitObject.Count)
                        {
                            LogManager.LogError("OSU文件中hitObject数目 与 txt文件中的单词数量不匹配");
                            return(null);
                        }

                        try
                        {
                            ClickObj click = new ClickObj(param[j], tmpHitObject[k].Position, wordShow[j]);
                            click.m_ClickTimes = 1;
                            sentenceobjs.ClickAndHOList.ClickObjs.Add(click);
                            tmpHitObject[k].Word = param[j];
                            if (wordSoundFile != null && wordSoundFile.Length > 0)
                            {
                                if (wordSoundFile.Length == param.Length)
                                {
                                    tmpHitObject[k].SonudFile = wordSoundFile[j];
                                }
                                else
                                {
                                    LogManager.LogError(string.Format("行 {0} 有错误:句子单词个数 与 单词语音文件数量不匹配", (i + 1)));
                                    return(null);
                                }
                            }
                            sentenceobjs.ClickAndHOList.HitObjects.Add(tmpHitObject[k]);
                            k++;
                        }
                        catch (Exception e)
                        {
                            LogManager.LogError("the wrong line is:", (i + 1).ToString());
                            LogManager.LogError(e);
                            LogManager.LogError(e.StackTrace);
                        }
                    }

                    InOutTime inOutTime = new InOutTime(startTime, endTime);
                    sentenceobjs.m_InOutTime = inOutTime;
                    //判断这一句是否应该延迟删除,下一句是否应该提前出现

                    if (endTime - sentenceobjs.ClickAndHOList.HitObjects[sentenceobjs.ClickAndHOList.HitObjects.Count - 1].StartMilliSecond < CorePlaySettings.Instance.m_MinIntervalBeforeSentenceEnd)
                    {                            //这一句延迟删除,下一句提前出现
                        if (nextSentenceAheadIn)
                        {
                            sentenceobjs.m_InOutTime.InOut = EffectInOutTiming.Both;
                        }
                        else
                        {
                            sentenceobjs.m_InOutTime.InOut = EffectInOutTiming.DelayOut;
                            nextSentenceAheadIn            = true;
                        }
                    }
                    else
                    {
                        if (nextSentenceAheadIn)
                        {
                            sentenceobjs.m_InOutTime.InOut = EffectInOutTiming.AheadIn;
                            nextSentenceAheadIn            = false;
                        }
                    }

                    songObj.SentenceObjs.Add(sentenceobjs);
                    #endregion
                }
                else
                {
                    #region boss句子
                    string[]            parse = oneLine.Split(',');
                    StreamSentenceGroup group = new StreamSentenceGroup();
                    if (parse.Length == 5 && parse[4].Equals("BB"))
                    {
                        group.CalckSentence = true;
                    }
                    else
                    {
                        group.CalckSentence = false;
                    }
                    group.SetTimeLength(int.Parse(parse[0]));
                    if (parse[1].Contains("#"))
                    {
                        group.SetSentenceType(SentenceType.Voice);
                        parse[1] = parse[1].Replace("#", "");
                    }
                    else
                    {
                        group.SetSentenceType(SentenceType.Common);
                    }
                    string[] matchSentences = parse[1].Replace("@@", "").Split('|');
                    string[] showSentences  = parse[2].Split('|');
                    string[] fileNames      = parse[3].Split('|');
                    if (matchSentences.Length != showSentences.Length || showSentences.Length != fileNames.Length)
                    {
                        LogManager.LogError("TXT文件 第 ", (i + 1).ToString(), "行报错:断句数量不匹配");
                        return(null);
                    }
                    else
                    {
                        int sentenceNumber = matchSentences.Length;
                        for (int line = 0; line < sentenceNumber; line++)
                        {
                            StreamSentence bossSentence = new StreamSentence();
                            bossSentence.SetAudioFileName(fileNames[line].ToLower());
                            string[] words     = matchSentences[line].Split('$');
                            string[] showWords = showSentences[line].Split('$');

                            if (words.Length != showWords.Length)
                            {
                                LogManager.LogError("TXT文件 第 ", (i + 1).ToString(), "行报错:单词数量不匹配 ",
                                                    words.Length.ToString(), "/" + showWords.Length.ToString());
                                return(null);
                            }
                            else
                            {
                                for (int index = 0; index < words.Length; index++)
                                {
                                    KeyValuePair <string, string> kv = new KeyValuePair <string, string> (words[index], showWords[index]);
                                    bossSentence.AddToSentence(kv);
                                }
                            }
                            group.AddSentence(bossSentence);
                        }
                    }

                    songObj.StreamSentences.Add(group);
                    #endregion
                }
                break;

            case CollectType.HitObject:
                if (oneLine.Contains("C") || oneLine.Contains("P") || oneLine.Contains("L") || oneLine.Contains("B"))
                {                        //2017年10月28日版本先不做这些功能
                    continue;
                }
                else
                {
                    string[] param = oneLine.Split(',');
                    if (param.Length != 6)
                    {
                        LogManager.LogError("data parse error: the data file is  --", fileName);
                    }
                    else
                    {
                        Vector2 pos       = new Vector2(int.Parse(param[0]), int.Parse(param[1]));
                        int     startTime = int.Parse(param[2]);
                        int     type      = int.Parse(param[3]);
                        int     soundType = int.Parse(param[4]);

                        HitObject ho = new HitObject(pos, startTime, type, soundType);

                        tmpHitObject.Add(ho);
                    }
                }
                break;

            case CollectType.KeyAndVoice:
                //LogManager.Log(oneLine , " |||||  case CollectType.KeyAndVoice:");

                string[] parses = oneLine.Split(',');
                if (parses.Length < 3)
                {
                    LogManager.LogError("TXT文件 第 ", (i + 1).ToString(), "行报错:分段不够");
                    return(null);
                }

                StreamSentence ss = new StreamSentence();
                ss.SetDuration(int.Parse(parses[0]) * 0.001f);
                if (parses[1].StartsWith("#", StringComparison.Ordinal))
                {
                    //parses[1] = parses[1].Substring(1);
                    parses[1] = parses[1].Replace("#", "");
                    //LogManager.Log ("   需要录音 = " , parses[1]);
                    ss.needRecord = true;
                    ss.SetType(SentenceType.NonRhythmVoice);
                    //if (parses[1].StartsWith ("#", StringComparison.Ordinal))
                    //{
                    //	parses[1] = parses[1].Substring (1);
                    //	ss.needRecord = true;
                    //}
                }
                else
                {
                    ss.SetType(SentenceType.NonRhythmCommon);
                }

                if (parses.Length == 4)
                {
                    string[] tempAudios = parses[3].Split('|');
                    if (string.IsNullOrEmpty(tempAudios[0]) == false)
                    {
                        ss.SetAudioFileName(tempAudios[0].ToLower());
                    }
                    if (tempAudios.Length == 2 && string.IsNullOrEmpty(tempAudios[1]) == false)
                    {
                        ss.Speaker = tempAudios[1];
                    }
                    //ss.SetAudioFileName(parses[3]);
                }

                string[] firstWords = parses[1].Split('$');
                string[] clickWords = parses[2].Split('$');

                if (firstWords.Length != clickWords.Length)
                {
                    LogManager.LogError("TXT文件 第 ", (i + 1).ToString(), "行报错:单词数量不匹配");
                    return(null);
                }
                else
                {
                    for (int index = 0; index < firstWords.Length; index++)
                    {
                        KeyValuePair <string, string> kv = new KeyValuePair <string, string> (firstWords[index], clickWords[index]);
                        ss.AddToSentence(kv);
                        //ClickObj click = new ClickObj(kv.Key, tmpHitObject[k].Position, kv.Value);
                        //ClickObj click = new ClickObj(kv.Key, Vector2.zero, kv.Value);
                        //click.m_ClickTimes = 1;
                        //ss.ClickAndHOList.ClickObjs.Add(click);
                        //tmpHitObject[k].Word = kv.Key;
                        //ss.ClickAndHOList.HitObjects.Add(tmpHitObject[k]);
                        //k++;
                    }
                }
                songObj.NonRhythmSenteces.Add(ss);
                break;
            }
        }

        songObj.SetContents(result);

        return(songObj);
    }
Ejemplo n.º 11
0
    public void Collect(Sprite sprite, Vector3 startCenter, Vector3 target, int number, AudioClip collectClip, CollectType type = CollectType.RandomStart, float startScale = 1, float endScale = 0.75f, int group = 1)
    {
        number = Mathf.Clamp(number, 1, maxImage);
        List <Image> currentGroup = group == 1 ? collectImages : collectImages2;
        Image        temp;

        for (int i = 0; i < number; i++)
        {
            temp = currentGroup[i];

            try
            {
                temp.gameObject.SetActive(true);
                temp.sprite = sprite;
                temp.transform.localPosition = startCenter;
                if (type == CollectType.RandomStart)
                {
                    temp.transform.localPosition += new Vector3(Random.Range(-250, 250), Random.Range(-400, 100), 0);
                }

                temp.transform.DOKill(true);
                float randTime       = Random.Range(0.5f, 1.2f);
                float delayTime      = type == CollectType.RandomStart ? Random.Range(0.1f, 0.5f) : i / 15f;
                float scaleTelorance = Random.Range(-0.3f, 0.3f);
                temp.transform.localScale = new Vector3(startScale, startScale, startScale) + new Vector3(scaleTelorance, scaleTelorance, scaleTelorance);
                temp.transform.DOScale(endScale, randTime).SetDelay(delayTime);
                temp.transform.DOLocalMove(target, randTime).SetDelay(delayTime).OnComplete(() =>
                {
                    temp.gameObject.SetActive(false);
                    if (collectClip != null)
                    {
                        Setting.AudioPlayer.PlayOneShot(collectClip, 1);
                    }
                });
                //collectImages[i].rectTransform.position
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
            }

            StartCoroutine(DeActiveAll(group, 3.2f));
        }
    }
 public  int getCollectsforType(CollectType type) {
     if (collectDictionary == null) {
         initCollectCounter();
     }
     return collectDictionary[type]; 
 }
 public  void addNewCollect(CollectType type) {
     if(collectDictionary == null) {
         initCollectCounter();
     }
     collectDictionary.Add(type, (collectDictionary[type] + 1));
 }
 public CurrentInventoryInput()
 {
     this.CollectType = CollectType.OnlyCostReported;
 }
 public CurrentInventoryInput(CollectType collectType)
 {
     this.CollectType = collectType;
 }
 public TransactionSummaryInput(DateTime start, DateTime stop, CollectType collectType)
 {
     this.StartDate   = start;
     this.StopDate    = stop;
     this.CollectType = collectType;
 }
 public TransactionSummaryInput()
 {
     this.StartDate   = DateTime.Now;
     this.StopDate    = DateTime.Now;
     this.CollectType = CollectType.OnlyCostReported;
 }
Ejemplo n.º 18
0
    public static SongTxtObject GetSongInfo(string fileName)
    {
        SongTxtObject songInfo = new SongTxtObject();

        string path = "/Resources/Songs/" + fileName + ".txt";

        if (DebugConfigController.Instance.RunTimeEditor)
        {
            path = Application.dataPath + path;
        }
        else
        {
            path = "Assets" + path;
        }
        songInfo.SongInfos.SongName = fileName;
        if (!File.Exists(path))
        {
            return(null);
        }
        string[] contents = File.ReadAllLines(path);
        m_CollectType = CollectType.General;

        int hitno = 0;

        for (int i = 0; i < contents.Length; i++)
        {
            string parseContent = contents[i].Trim();

            if (string.IsNullOrEmpty(parseContent))
            {
                continue;
            }

            if (parseContent.Contains("[HitObjects]"))
            {
                m_CollectType = CollectType.HitObject;
                continue;
            }

            if (parseContent.Contains("[SentenceInfo]"))
            {
                m_CollectType = CollectType.SentenceInfo;
                continue;
            }

            if (parseContent.Contains("@@"))
            {
                m_CollectType = CollectType.Boss;
                string[] timeTemp = parseContent.Split(',');
                if (timeTemp.Length < 2)
                {
                    LogManager.LogError("data parse error: the data file is  --", path);
                }
                if (parseContent.Contains("@@VoiceStart"))
                {
                    songInfo.BossInfos.IsBoss    = false;
                    songInfo.BossInfos.StartTime = -1;
                    songInfo.BossInfos.DelayTime = int.Parse(timeTemp[1]);
                }
                else
                {
                    songInfo.BossInfos.IsBoss    = true;
                    songInfo.BossInfos.StartTime = int.Parse(timeTemp[0].Replace("@@", ""));
                    songInfo.BossInfos.DelayTime = int.Parse(timeTemp[1]);
                }
                continue;
            }

            switch (m_CollectType)
            {
            case CollectType.General:
                if (parseContent.Contains("AudioFileName:"))
                {
                    songInfo.SongInfos.AudioFileName = parseContent.Replace("AudioFileName:", "");
                }
                else if (parseContent.Contains("BPM:"))
                {
                    songInfo.SongInfos.BPM = int.Parse(parseContent.Replace("BPM:", ""));
                }
                break;

            case CollectType.HitObject:
                string[] param = parseContent.Split(',');
                if (param.Length < 3)
                {
                    LogManager.LogError("data parse error: the data file is  --", path);
                }
                else
                {
                    Vector2 pos = new Vector2(int.Parse(param[0]), int.Parse(param[1]));

                    Vector2 pos2      = new Vector2(pos.x * (1400f / 512f) - 700f, 525 - pos.y * (1400f / 512f));
                    int     startTime = int.Parse(param[2]);

                    HitInfo ho = new HitInfo();
                    ho.HitTime  = startTime;
                    ho.Position = pos2;
                    if (songInfo.HitInfos.Count > 0)
                    {
                        songInfo.HitInfos[songInfo.HitInfos.Count - 1].EndHitTime = ho.HitTime - 100;
                    }
                    ho.StartHitTime = ho.HitTime;
                    ho.Type         = SentenceInfo.SentenceType.ClickNode;
                    ho.EndHitTime   = ho.HitTime + 2000;
                    ho.SoundText    = "SE";
                    ho.ClickText    = "SE";
                    songInfo.HitInfos.Add(ho);
                }
                break;

            case CollectType.SentenceInfo:
                string[] temp = parseContent.Split(',');
                //加了配音字段,先注掉
                if (temp.Length != 4 && false)
                {
                    LogManager.LogError("data parse error: the data file is  --", path);
                    LogManager.LogError("parseContent: ", parseContent);
                }
                else
                {
                    SentenceInfo sentence = new SentenceInfo();
                    sentence.StartTime = int.Parse(temp[0]);
                    sentence.EndTime   = int.Parse(temp[1]);
                    if (temp[2].Contains("#"))
                    {
                        temp[2]       = temp[2].Replace("#", "");
                        sentence.Type = SentenceInfo.SentenceType.SoundNode;
                    }
                    else
                    {
                        sentence.Type = SentenceInfo.SentenceType.ClickNode;
                    }
                    string[] SoundText = temp[2].Split('$');
                    string[] ClickText = temp[3].Split('$');
                    for (int textNum = 0; hitno < songInfo.HitInfos.Count; hitno++, textNum++)
                    {
                        if (songInfo.HitInfos[hitno].HitTime >= sentence.StartTime && songInfo.HitInfos[hitno].HitTime <= sentence.EndTime)
                        {
                            songInfo.HitInfos[hitno].StartHitTime = sentence.StartTime;
                            songInfo.HitInfos[hitno].EndHitTime   = sentence.EndTime;
                            songInfo.HitInfos[hitno].Type         = sentence.Type;
                            if (sentence.Type == SentenceInfo.SentenceType.SoundNode)
                            {
                                songInfo.HitInfos[hitno].HitTime = sentence.StartTime;
                            }
                            if (textNum < SoundText.Length && textNum < ClickText.Length)
                            {
                                songInfo.HitInfos[hitno].SoundText = SoundText[textNum];
                                songInfo.HitInfos[hitno].ClickText = ClickText[textNum];
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                break;

            case CollectType.Boss:
                string[] bossTemp = parseContent.Split(',');
                if ((songInfo.BossInfos.IsBoss && bossTemp.Length != 5) || (!songInfo.BossInfos.IsBoss && bossTemp.Length != 4 && bossTemp.Length != 3))
                {
                    LogManager.LogError("data parse error: the data file is  --", path);
                }
                BossLineInfo lineTemp = new BossLineInfo();
                lineTemp.KeepTimeLength = int.Parse(bossTemp[0]);
                if (bossTemp[1].Contains("#"))
                {
                    lineTemp.Type = SentenceInfo.SentenceType.SoundNode;
                }
                else
                {
                    lineTemp.Type = SentenceInfo.SentenceType.ClickNode;
                }
                lineTemp.SoundText = bossTemp[1].Replace("#", "");
                lineTemp.ClickText = bossTemp[2].Replace("#", "");
                if (bossTemp.Length > 3)
                {
                    lineTemp.MusicFileName = bossTemp[3];
                }
                if (songInfo.BossInfos.IsBoss && bossTemp[4] == "BB")
                {
                    lineTemp.IsEnd = true;
                }
                else
                {
                    lineTemp.IsEnd = false;
                }
                songInfo.BossInfos.BossLineObject.Add(lineTemp);
                break;
            }
        }
        return(songInfo);
    }
Ejemplo n.º 19
0
        }         // SelectPeriod

        // ----------------------------------------------------------------------
        private void Collect(CollectType collectType)
        {
            // filter
            CalendarPeriodCollectorFilter filter = new CalendarPeriodCollectorFilter();

            foreach (int year in yearFilter.SelectedItems)
            {
                filter.Years.Add(year);
            }
            foreach (YearMonth yearMonth in yearMonthFilter.SelectedItems)
            {
                filter.Months.Add(yearMonth);
            }
            foreach (int day in dayFilter.SelectedItems)
            {
                filter.Days.Add(day);
            }
            foreach (DayOfWeek dayOfWeek in dayOfWeekFilter.SelectedItems)
            {
                filter.WeekDays.Add(dayOfWeek);
            }

            // period limits
            TimeRange workingTimeRange = WorkingTimeRange;

            if (workingTimeRange == null)
            {
                CollectorStatus = "Invalid Working Time Range!";
                return;
            }

            // collect months
            YearMonth?collectMonthStart = CollectMonthStart;
            YearMonth?collectMonthEnd   = CollectMonthEnd;

            if (collectMonthStart.HasValue && collectMonthEnd.HasValue)
            {
                if (collectMonthEnd.Value < collectMonthStart.Value)
                {
                    CollectorStatus = "Invalid Collecting Periods Months!";
                    return;
                }
                filter.CollectingMonths.Add(new MonthRange(collectMonthStart.Value, collectMonthEnd.Value));
            }

            // collect day
            int?collectDayStart = CollectDayStart;
            int?collectDayEnd   = CollectDayEnd;

            if (collectDayStart.HasValue && collectDayEnd.HasValue)
            {
                if (collectDayEnd.Value < collectDayStart.Value)
                {
                    CollectorStatus = "Invalid Collecting Periods Days!";
                    return;
                }
                filter.CollectingDays.Add(new DayRange(collectDayStart.Value, collectDayEnd.Value));
            }

            // collect hour
            int?collectHourStart = CollectHourStart;
            int?collectHourEnd   = CollectHourEnd;

            if (collectHourStart.HasValue && collectHourEnd.HasValue)
            {
                if (collectHourEnd.Value < collectHourStart.Value)
                {
                    CollectorStatus = "Invalid Collecting Periods Hours!";
                    return;
                }
                filter.CollectingHours.Add(new HourRange(collectHourStart.Value, collectHourEnd.Value));
            }

            StringBuilder status = new StringBuilder();

            // collector
            string collectContext = string.Empty;

            TimePeriod.CalendarPeriodCollector collector =
                new TimePeriod.CalendarPeriodCollector(filter, workingTimeRange);
            switch (collectType)
            {
            case CollectType.Year:
                collectContext = "year";
                collector.CollectYears();
                break;

            case CollectType.Month:
                collectContext = "month";
                collector.CollectMonths();
                break;

            case CollectType.Day:
                collectContext = "day";
                collector.CollectDays();
                break;

            case CollectType.Hour:
                collectContext = "hour";
                collector.CollectHours();
                break;
            }

            collectedPeriods.Clear();
            if (collector.Periods.Count == 0)
            {
                status.Append(string.Format("no {0} periods found", collectContext));
            }
            else if (collector.Periods.Count > maxPeriodCount)
            {
                status.Append(string.Format("{0} {1} periods found, a maximum of {2} periods can be displayed",
                                            collector.Periods.Count, collectContext, maxPeriodCount));
            }
            else
            {
                foreach (ITimePeriod timePeriod in collector.Periods)
                {
                    collectedPeriods.Add(timePeriod);
                }
                status.Append(string.Format("{0} {1} periods found", collectedPeriods.Count, collectContext));
            }

            CollectorStatus    = status.ToString();
            LastCollectionDate = DateTime.Now;

            if (CopyToClipboard)
            {
                collectedPeriods.CopyToClipboard();
            }
        }         // Collect
Ejemplo n.º 20
0
        public ActionResult DoCollect(CollectViewModel model)
        {
            model.CheckNotNull(nameof(model));
            if (CurrentUser == null)
            {
                return(Json(new AjaxResult("未登录", AjaxResultType.Error)));
            }
            //获取收藏类型
            CollectType collectType = GetCollectType(model.Type);
            //检查收藏状态
            Collect collect = IdentityContract.Collects.SingleOrDefault(c => c.User.Id == CurrentUser.Id && c.AboutId == model.AboutId && c.Type == collectType);

            if (collect == null)
            {
                CollectInputDto dto = new CollectInputDto()
                {
                    UserId  = CurrentUser.Id,
                    AboutId = model.AboutId,
                    Pic     = "default",
                    Type    = collectType
                };

                if (collectType == CollectType.Goods)
                {
                    //检查商品
                    Hmh.Core.Goods.Models.Goods goods = GoodsContract.Goodss.SingleOrDefault(g => g.Id == model.AboutId);
                    if (goods == null)
                    {
                        return(Json(new AjaxResult("错误商品不存在", AjaxResultType.Error)));
                    }
                    dto.Name = goods.Name;
                }
                else
                {
                    //检查店铺
                    Hmh.Core.Shop.Models.Shop shop = ShopContract.Shops.SingleOrDefault(s => s.Id == model.AboutId);
                    if (shop == null)
                    {
                        return(Json(new AjaxResult("错误店铺不存在", AjaxResultType.Error)));
                    }
                    dto.Name = shop.Name;
                }

                OperationResult result = IdentityContract.AddCollects(dto);
                if (result.ResultType == OperationResultType.Success)
                {
                    return(Json(new AjaxResult("已收藏", AjaxResultType.Success)));
                }
                else
                {
                    return(Json(new AjaxResult("失败", AjaxResultType.Error)));
                }
            }
            else
            {
                OperationResult result = IdentityContract.DeleteCollects(collect.Id);
                if (result.ResultType == OperationResultType.Success)
                {
                    return(Json(new AjaxResult("收藏", AjaxResultType.Success)));
                }
                else
                {
                    return(Json(new AjaxResult("失败", AjaxResultType.Error)));
                }
            }
        }
Ejemplo n.º 21
0
 public void SetCollectType(CollectType collectType)
 {
     this.collectType = collectType;
 }
 public MonthlyReportInput()
 {
     this.StartDate   = DateTime.Now;
     this.StopDate    = DateTime.Now;
     this.CollectType = CollectType.OnlyCostReported;
 }
 public MonthlyReportInput(DateTime start, DateTime stop, CollectType collectType)
 {
     this.StartDate   = start;
     this.StopDate    = stop;
     this.CollectType = collectType;
 }
Ejemplo n.º 24
0
 public CollectForm()
 {
     InitializeComponent();
     this.Text = string.Format("{0}数据汇总", CollectType.GetDescription());
 }
Ejemplo n.º 25
0
        // ----------------------------------------------------------------------
        private void Collect( CollectType collectType )
        {
            // filter
            CalendarPeriodCollectorFilter filter = new CalendarPeriodCollectorFilter();
            foreach ( int year in yearFilter.SelectedItems )
            {
                filter.Years.Add( year );
            }
            foreach ( YearMonth yearMonth in yearMonthFilter.SelectedItems )
            {
                filter.Months.Add( yearMonth );
            }
            foreach ( int day in dayFilter.SelectedItems )
            {
                filter.Days.Add( day );
            }
            foreach ( DayOfWeek dayOfWeek in dayOfWeekFilter.SelectedItems )
            {
                filter.WeekDays.Add( dayOfWeek );
            }

            // period limits
            TimeRange workingTimeRange = WorkingTimeRange;
            if ( workingTimeRange == null )
            {
                CollectorStatus = "Invalid Working Time Range!";
                return;
            }

            // collect months
            YearMonth? collectMonthStart = CollectMonthStart;
            YearMonth? collectMonthEnd = CollectMonthEnd;
            if ( collectMonthStart.HasValue && collectMonthEnd.HasValue )
            {
                if ( collectMonthEnd.Value < collectMonthStart.Value )
                {
                    CollectorStatus = "Invalid Collecting Periods Months!";
                    return;
                }
                filter.CollectingMonths.Add( new MonthRange( collectMonthStart.Value, collectMonthEnd.Value ) );
            }

            // collect day
            int? collectDayStart = CollectDayStart;
            int? collectDayEnd = CollectDayEnd;
            if ( collectDayStart.HasValue && collectDayEnd.HasValue )
            {
                if ( collectDayEnd.Value < collectDayStart.Value )
                {
                    CollectorStatus = "Invalid Collecting Periods Days!";
                    return;
                }
                filter.CollectingDays.Add( new DayRange( collectDayStart.Value, collectDayEnd.Value ) );
            }

            // collect hour
            int? collectHourStart = CollectHourStart;
            int? collectHourEnd = CollectHourEnd;
            if ( collectHourStart.HasValue && collectHourEnd.HasValue )
            {
                if ( collectHourEnd.Value < collectHourStart.Value )
                {
                    CollectorStatus = "Invalid Collecting Periods Hours!";
                    return;
                }
                filter.CollectingHours.Add( new HourRange( collectHourStart.Value, collectHourEnd.Value ) );
            }

            StringBuilder status = new StringBuilder();

            // collector
            string collectContext = string.Empty;
            TimePeriod.CalendarPeriodCollector collector =
                new TimePeriod.CalendarPeriodCollector( filter, workingTimeRange );
            switch ( collectType )
            {
                case CollectType.Year:
                    collectContext = "year";
                    collector.CollectYears();
                    break;
                case CollectType.Month:
                    collectContext = "month";
                    collector.CollectMonths();
                    break;
                case CollectType.Day:
                    collectContext = "day";
                    collector.CollectDays();
                    break;
                case CollectType.Hour:
                    collectContext = "hour";
                    collector.CollectHours();
                    break;
            }

            collectedPeriods.Clear();
            if ( collector.Periods.Count == 0 )
            {
                status.Append( string.Format( "no {0} periods found", collectContext ) );
            }
            else if ( collector.Periods.Count > maxPeriodCount )
            {
                status.Append( string.Format( "{0} {1} periods found, a maximum of {2} periods can be displayed",
                                                                            collector.Periods.Count, collectContext, maxPeriodCount ) );
            }
            else
            {
                foreach ( ITimePeriod timePeriod in collector.Periods )
                {
                    collectedPeriods.Add( timePeriod );
                }
                status.Append( string.Format( "{0} {1} periods found", collectedPeriods.Count, collectContext ) );
            }

            CollectorStatus = status.ToString();
            LastCollectionDate = DateTime.Now;

            if ( CopyToClipboard )
            {
                collectedPeriods.CopyToClipboard();
            }
        }