Beispiel #1
0
    private bool CanPlayActorTriggerSpell(Entity entity, Spell spell, bool spellInitialized)
    {
        if ((!entity.HasTriggerVisual() && !entity.IsPoisonous()) && !entity.HasInspire())
        {
            return(false);
        }
        if (((entity.GetController() != null) && !entity.GetController().IsFriendlySide()) && entity.IsObfuscated())
        {
            return(false);
        }
        Card cardWithActorTrigger = this.GetCardWithActorTrigger(entity);

        if (cardWithActorTrigger == null)
        {
            return(false);
        }
        if (cardWithActorTrigger.WillSuppressActorTriggerSpell())
        {
            return(false);
        }
        if (spell != null)
        {
            if (!spellInitialized)
            {
                return(false);
            }
        }
        else if (!SpellUtils.CanAddPowerTargets(base.m_taskList))
        {
            return(false);
        }
        return(true);
    }
    protected virtual bool AddPowerSourceAndTargets(PowerTaskList taskList)
    {
        if (!this.HasSourceCard(taskList))
        {
            return(false);
        }
        if (!SpellUtils.CanAddPowerTargets(taskList))
        {
            return(false);
        }
        Card card = taskList.GetSourceEntity().GetCard();

        this.SetSource(card);
        List <PowerTask> list = this.m_taskList.GetTaskList();

        for (int i = 0; i < list.Count; i++)
        {
            PowerTask task = list[i];
            Card      targetCardFromPowerTask = this.GetTargetCardFromPowerTask(task);
            if (((targetCardFromPowerTask != null) && (card != targetCardFromPowerTask)) && !this.IsTarget(targetCardFromPowerTask))
            {
                this.AddTarget(targetCardFromPowerTask);
            }
        }
        return((card != null) || (this.m_targets.Count > 0));
    }
 public void UpdateOrientation()
 {
     if (this.m_orientationDirty)
     {
         SpellUtils.SetOrientationFromFacing(this);
         this.m_orientationDirty = false;
     }
 }
 public void UpdatePosition()
 {
     if (this.m_positionDirty)
     {
         SpellUtils.SetPositionFromLocation(this, this.m_SetParentToLocation);
         this.m_positionDirty = false;
     }
 }
 private AudioSource SearchForClassSpecificVo()
 {
     foreach (SpellZoneTag tag in this.m_ClassSpecificVoData.m_ZonesToSearch)
     {
         List <Zone> zones  = SpellUtils.FindZonesFromTag(this, tag, this.m_ClassSpecificVoData.m_SideToSearch);
         AudioSource source = this.SearchForClassSpecificVo(zones);
         if (source != null)
         {
             return(source);
         }
     }
     return(null);
 }
Beispiel #6
0
        /// <summary>
        /// 加载节目预告
        /// </summary>
        private object LoadItems(LiveVideoNode video, IEnumerable <ChannelLiveItemsNode> items)
        {
            video.Items = items.OrderBy(i => i.StartTime).ToPerfectList();
            ListUtils <LiveVideoNode> .SetFlags(video, v => true);

            ListUtils <LiveVideoNode> .SetPV(video);

            ListUtils <LiveVideoNode> .SetLiveSlotImage(video);

            ListUtils <VideoNode> .SetForbidden(video);

            video.SpellName = SpellUtils.GetChineseFrist(video.Main.Name);
            return(null);
        }
 private bool SearchForCard()
 {
     if (!string.IsNullOrEmpty(this.m_CardSpecificVoData.m_CardId))
     {
         foreach (SpellZoneTag tag in this.m_CardSpecificVoData.m_ZonesToSearch)
         {
             List <Zone> zones = SpellUtils.FindZonesFromTag(this, tag, this.m_CardSpecificVoData.m_SideToSearch);
             if (this.IsCardInZones(zones))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Beispiel #8
0
        public void AfterSegment(SuperLinkedList <WordInfo> result)
        {
            if (Text.Length > SettingCache.MaxIndex)
            {
                return;
            }
            var list    = SpellUtils.FormatFirstWord(Text);
            var builder = new StringBuilder(10);

            for (int i = 0; i < list.Count; i++)
            {
                if (SpellUtils.IsCnOrNum(list[i]))
                {
                    builder.Append(list[i]);
                    if (list[i].Length < 2)
                    {
                        continue;
                    }
                    var cns = SpellUtils.GetSpellSegment(list[i], false, true);
                    if (cns != null)
                    {
                        foreach (var cn in cns)
                        {
                            var n = cn;
                            if (i != 0)
                            {
                                n = string.Format("{0}{1}", cn, Text.Replace(list[i], ""));
                            }
                            AddIndex(result, n, i, SettingCache.MaxIndex - i);
                        }
                    }
                }
                else
                {
                    builder.Append(list[i][0]);
                }
            }
            var results = SpellUtils.GetSpellSegment(builder.ToString(), false, true);

            if (results != null)
            {
                foreach (var r in results)
                {
                    AddIndex(result, r, 0, SettingCache.MaxIndex);
                }
            }
        }
 protected void BlockZones(bool block)
 {
     if (this.m_ZonesToDisable != null)
     {
         foreach (SpellZoneTag tag in this.m_ZonesToDisable)
         {
             List <Zone> list = SpellUtils.FindZonesFromTag(tag);
             if (list != null)
             {
                 foreach (Zone zone in list)
                 {
                     zone.BlockInput(block);
                 }
             }
         }
     }
 }
Beispiel #10
0
        /// <summary>
        /// 过滤不符合的频道
        /// </summary>
        private bool FilterVideo(VideoNode video)
        {
            var result = (video.ViceChannels == null ? 2 : video.ViceChannels.Count) >= AppSettingCache.VodFilterState[video.Type - 1] && video.Main.TimeLength / 60 >= AppSettingCache.VodFilterDuration[video.Type - 1];

            if (result)
            {
                ListUtils <VideoNode> .SetFlags(video, v => v.Type == 1);

                ListUtils <VideoNode> .SetPV(video);

                ListUtils <VideoNode> .SetSlotImage(video);

                ListUtils <VideoNode> .SetForbidden(video);

                video.SpellName = SpellUtils.GetChineseFrist(video.Main.Name);
            }
            return(result);
        }
        public async Task ExecuteLoadAttentionsCommand()
        {
            var items = await new MockDataStore().GetItemsAsync();
            var g     = from i in items
                        group i by SpellUtils.GetFirstPinyin(i.Name[0], "★").ToUpper();

            foreach (var item in g)
            {
                var at = new AttentionList
                {
                    GroupTitle = item.Key,
                    ShortName  = item.Key
                };
                foreach (var item2 in item.ToList <User>())
                {
                    at.Add(item2);
                }
                Attentions.Add(at);
            }
        }
    protected override void UpdateVisualTargets()
    {
        int num = this.NumberOfCardsInOpponentsHand();

        base.m_TargetInfo.m_RandomTargetCountMin = num;
        base.m_TargetInfo.m_RandomTargetCountMax = num;
        ZonePlay zonePlay = SpellUtils.FindOpponentPlayZone(this);

        base.GenerateRandomPlayZoneVisualTargets(zonePlay);
        for (int i = 0; i < base.m_targets.Count; i++)
        {
            if (i < base.m_visualTargets.Count)
            {
                base.m_visualTargets[i] = base.m_targets[i];
            }
            else
            {
                this.AddVisualTarget(base.m_targets[i]);
            }
        }
    }
    protected override bool AddPowerSourceAndTargets(PowerTaskList taskList)
    {
        this.Reset();
        if (!this.HasSourceCard(taskList))
        {
            return(false);
        }
        Entity sourceEntity = taskList.GetSourceEntity();
        Card   card         = sourceEntity.GetCard();
        Spell  spell        = this.DeterminePowerSpell(sourceEntity, card);

        if (sourceEntity.IsMinion())
        {
            if (!this.InitPowerSpell(card, spell))
            {
                if (!SpellUtils.CanAddPowerTargets(taskList))
                {
                    return(false);
                }
                if (this.GetActorBattlecrySpell(card) == null)
                {
                    return(false);
                }
            }
        }
        else
        {
            this.InitPowerSpell(card, spell);
            List <CardSoundSpell> soundSpells = this.DeterminePowerSounds(sourceEntity, card);
            this.InitPowerSounds(card, soundSpells);
            if ((this.m_powerSpell == null) && (this.m_powerSoundSpells.Count == 0))
            {
                return(false);
            }
        }
        base.SetSource(card);
        return(true);
    }
Beispiel #14
0
        public void SpellTest()
        {
            LuceneEngine engine = new LuceneEngine();

            engine.Init();
            var firsts     = SpellUtils.GetCnSegment("NBA常规赛-快船vs凯尔特人");
            var spells     = SpellUtils.GetSpellSegment("战重警和");
            var segment    = new Segment();
            var collection = segment.DoSegment("国际足球100509K联赛釜山-大田");
            var list       = new List <string>();

            foreach (WordInfo word in collection)
            {
                if (word == null)
                {
                    continue;
                }
                list.Add(word.Word);
            }
            //var list = SpellUtils.GetSpellSegment("战警");
            string         sss  = "san国yan义";
            string         ssss = Synacast.LuceneNetSearcher.Searcher.Searcher.SegmentKeyWord(sss);
            string         text = "重庆";
            TextReader     tr   = new StringReader(text);
            PanGuTokenizer ct   = new PanGuTokenizer(tr);
            int            end  = 0;

            Lucene.Net.Analysis.Token t;
            string ss = string.Empty;

            while (end < text.Length)
            {
                t   = ct.Next();
                end = t.EndOffset();
                ss  = ss + t.TermText() + "/ ";
            }
        }
 private AudioSource SearchForClassSpecificVo(List <Zone> zones)
 {
     if (zones != null)
     {
         foreach (Zone zone in zones)
         {
             foreach (Card card in zone.GetCards())
             {
                 SpellClassTag tag = SpellUtils.ConvertClassTagToSpellEnum(card.GetEntity().GetClass());
                 if (tag != SpellClassTag.NONE)
                 {
                     foreach (ClassSpecificVoLine line in this.m_ClassSpecificVoData.m_Lines)
                     {
                         if (line.m_Class == tag)
                         {
                             return(line.m_AudioSource);
                         }
                     }
                 }
             }
         }
     }
     return(null);
 }
Beispiel #16
0
        /// <summary>
        /// 加载合集
        /// </summary>
        private bool LoadChildren(VideoNode video, IEnumerable <ViceChannelInfo> children)
        {
            bool result = true;
            IEnumerable <ViceChannelInfo> cs = null;

            if (IsTV(video))
            {
                cs = children.OrderBy(channel => channel.Rank);  //电视合集时,从第一集开始
            }
            else
            {
                cs = children.OrderByDescending(channel => channel.Rank);  //综艺、专题合集时,将最近更新的放在最前
            }
            var isnumber = true;

            if (video.Main.TableType == 0)
            {
                video.Groups = new List <int>(1);
                video.Groups.Add(video.Main.ChannelID);
                video.ViceChannels = cs.Select(v =>
                {
                    isnumber = isnumber && SpellUtils.IsNumber(v.Name);
                    return(new ViceNode()
                    {
                        Language = SimpleLanguageHandler.ProcessLang(v.Name, v.NameEng),
                        ChannelId = v.ChannelID,
                        Duration = v.TimeLength,
                        PlayLink = PlayLinkUtils.MakePlayLink(v.FileName)
                    });
                }).ToPerfectList();
                if (video.ViceChannels.Count > 0)
                {
                    video.PlayLink = video.ViceChannels[0].PlayLink;
                    int count = video.ViceChannels.Count;
                    video.State = video.StateCount = count;
                    if (IsTV(video))
                    {
                        int state = 0;
                        if (int.TryParse(video.ViceChannels[count - 1].Language[CustomArray.LanguageArray[0]].Title, out state))
                        {
                            video.State = state;
                        }
                    }
                }
                else
                {
                    isnumber       = SpellUtils.IsNumber(video.ChannelName);
                    video.State    = video.StateCount = 1;
                    video.PlayLink = PlayLinkUtils.MakePlayLink(video.Main.FileName);
                }
            }
            else if (video.Main.TableType == 2)
            {
                video.Groups = cs.Select(v => v.ChannelID).ToPerfectList();
                if (video.Groups.Count <= 0)
                {
                    return(false);
                }
            }
            else
            {
                video.Virtuals = cs.Select(v => v.ChannelID).ToPerfectList();
                if (video.Virtuals.Count <= 0)
                {
                    return(false);
                }
                video.Groups = new List <int>(1);
                video.Groups.Add(video.Virtuals[0]);
            }
            video.IsNumber = Convert.ToInt32(isnumber);
            return(result);
        }
 protected void InitActorVariables()
 {
     this.m_actor              = SpellUtils.GetParentActor(this);
     this.m_rootObject         = SpellUtils.GetParentRootObject(this);
     this.m_rootObjectRenderer = SpellUtils.GetParentRootObjectMesh(this);
 }
 protected bool CanAddPowerTargets()
 {
     return(SpellUtils.CanAddPowerTargets(this.m_taskList));
 }
Beispiel #19
0
        public PanGuTokenizer(TextReader input)
            : base(input)
        {
            _inputText = base.input.ReadToEnd();

            if (string.IsNullOrEmpty(_inputText))
            {
                char[]        readBuf  = new char[1024];
                int           relCount = base.input.Read(readBuf, 0, readBuf.Length);
                StringBuilder inputStr = new StringBuilder(readBuf.Length);

                while (relCount > 0)
                {
                    inputStr.Append(readBuf, 0, relCount);

                    relCount = input.Read(readBuf, 0, readBuf.Length);
                }

                if (inputStr.Length > 0)
                {
                    _inputText = inputStr.ToString();
                }
            }

            _isFlag = AnalyzInput();
            if (!_isFlag)       //盘古分词
            {
                global::PanGu.Segment segment = new Segment();
                var wordInfos = segment.DoSegment(_inputText);
                foreach (var wi in wordInfos)
                {
                    var list = SpellUtils.GetSpellSegment(wi.Word);
                    if (list != null)
                    {
                        _segmentList.AddRange(list);
                    }
                }
                _wordList = new List <WordInfo>(wordInfos);
            }
            else
            {
                if (_inputText.EndsWith(_indexFlag))  //逗号空格分词
                {
                    string[] sources = _inputText.Replace(_indexFlag, "").Split(_splitFlag, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string source in sources)
                    {
                        _segmentList.Add(source);
                        var spells = SpellUtils.GetSpellSegment(source);
                        if (spells != null)
                        {
                            _segmentList.AddRange(spells);
                        }
                    }
                }
                else if (_inputText.EndsWith(_indexCnName))  //拼音首字母分词
                {
                    string source = _inputText.Replace(_indexCnName, "");
                    _wordList = SpellUtils.GetCnSegment(source);
                }
                else  //flag分词
                {
                    string source = _inputText.Replace("|", "");
                    for (int i = 0; i < source.Length; i++)
                    {
                        string first = source[i].ToString();
                        _segmentList.Add(first);
                        int f = 1;
                        for (int j = i + 1; j < source.Length; j++)
                        {
                            string s = string.Format("{0}|{1}", first, source[j]);
                            _segmentList.Add(s);
                            first = s;
                            if (j == source.Length - 1)
                            {
                                f++;
                                j     = i + f - 1;
                                first = source[i].ToString();
                            }
                        }
                    }
                }
            }
        }