Esempio n. 1
0
        public void Template_In_Non_Matching_Style_Is_Not_Built()
        {
            var instantiationCount = 0;
            var template           = new FuncTemplate <Class1>(() =>
            {
                ++instantiationCount;
                return(new Class1());
            });

            Styles styles = new Styles
            {
                new Style(x => x.OfType <Class1>().Class("foo"))
                {
                    Setters =
                    {
                        new Setter(Class1.ChildProperty, template),
                    },
                },

                new Style(x => x.OfType <Class1>())
                {
                    Setters =
                    {
                        new Setter(Class1.ChildProperty, template),
                    },
                }
            };

            var target = new Class1();

            styles.TryAttach(target, null);

            Assert.NotNull(target.Child);
            Assert.Equal(1, instantiationCount);
        }
Esempio n. 2
0
        private bool IsOnlyHaveDeliveryDart(Hotfix_LT.Data.MainLandEncounterTemplate met)
        {
            int[] func_ids = new int[3] {
                met.func_id_1, met.func_id_2, met.func_id_3
            };
            if (met.func_id_1 == 0 && met.func_id_2 == 0 && met.func_id_3 == 0)
            {
                return(false);
            }

            bool isOnlyDeliveryDart = true;

            for (var i = 0; i < func_ids.Length; i++)
            {
                int id = func_ids[i];

                if (id > 0)
                {
                    FuncTemplate func = Hotfix_LT.Data.FuncTemplateManager.Instance.GetFunc(id);
                    if (func.ui_model != "DeliveryDart")
                    {
                        isOnlyDeliveryDart = false;
                    }
                }
            }

            return(isOnlyDeliveryDart);
        }
Esempio n. 3
0
        private void SetRP2()
        {
            if (m_Functions.Count > 1)
            {
                switch (m_Functions[1].id)
                {
                //荣耀角斗场
                case 10090:
                {
                    bool         rp        = false;
                    FuncTemplate m_FuncTpl = FuncTemplateManager.Instance.GetFunc(10090);
                    if (m_FuncTpl.IsConditionOK())
                    {
                        int freetimes = HonorArenaManager.Instance.GetHonorArenaFreeTimes();
                        int usetimes  = HonorArenaManager.Instance.Info.usedTimes;
                        rp = freetimes > usetimes;
                    }
                    m_FunctionRP2.CustomSetActive(rp);
                }
                break;

                default: m_FunctionRP2.CustomSetActive(false); break;
                }
            }
        }
Esempio n. 4
0
        public void Materializes_Template_Should_Be_NameScope()
        {
            var control  = new Decorator();
            var template = new FuncTemplate <Canvas>(() => new Canvas());
            var style    = Mock.Of <IStyle>();
            var setter   = new Setter(Decorator.ChildProperty, template);

            setter.Apply(style, control, null);

            Assert.NotNull(NameScope.GetNameScope((Control)control.Child));
        }
Esempio n. 5
0
        public void Setter_Should_Materialize_Template_To_Property()
        {
            var control  = new Decorator();
            var template = new FuncTemplate <Canvas>(() => new Canvas());
            var style    = Mock.Of <IStyle>();
            var setter   = new Setter(Decorator.ChildProperty, template);

            setter.Apply(style, control, null);

            Assert.IsType <Canvas>(control.Child);
        }
Esempio n. 6
0
        public void Materializes_Template_Should_Be_NameScope()
        {
            var control = new Decorator();
            var template = new FuncTemplate<Canvas>(() => new Canvas());
            var style = Mock.Of<IStyle>();
            var setter = new Setter(Decorator.ChildProperty, template);

            setter.Apply(style, control, null);

            Assert.NotNull(NameScope.GetNameScope((Control)control.Child));
        }
Esempio n. 7
0
        public void Setter_Should_Materialize_Template_To_Property()
        {
            var control = new Decorator();
            var template = new FuncTemplate<Canvas>(() => new Canvas());
            var style = Mock.Of<IStyle>();
            var setter = new Setter(Decorator.ChildProperty, template);

            setter.Apply(style, control, null);

            Assert.IsType<Canvas>(control.Child);
        }
Esempio n. 8
0
        public void GotoGacha(string boxid)
        {
            FuncTemplate ft = FuncTemplateManager.Instance.GetFunc(10011);

            if (ft != null && !ft.IsConditionOK())
            {
                MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, ft.GetConditionStr());
                return;
            }

            GlobalMenuManager.Instance.Open("LTDrawCardTypeUI", boxid);
        }
Esempio n. 9
0
        /// <summary>
        /// 判断睡梦之塔的红点
        /// </summary>
        /// <returns></returns>
        public void Expedition_SleepTower()
        {
            Hashtable data;

            DataLookupsCache.Instance.SearchDataByID <Hashtable>("userSleepTower", out data);
            FuncTemplate m_FuncTpl = FuncTemplateManager.Instance.GetFunc(10085);

            if (data == null || !m_FuncTpl.IsConditionOK())
            {
                LTRedPointSystem.Instance.SetRedPointNodeNum(RedPointConst.climingtower, 0);
                return;
            }
            ParstData(data);
        }
Esempio n. 10
0
        public bool ArenaRP()
        {
            FuncTemplate m_FuncTpl = FuncTemplateManager.Instance.GetFunc(10018);

            if (m_FuncTpl.IsConditionOK())
            {
                ArenaInfo info       = ArenaManager.Instance.Info;
                int       totalTimes = VIPTemplateManager.Instance.GetTotalNum(VIPPrivilegeKey.ArenaTimes) + info.buyTimes;
                return(totalTimes - info.usedTimes > 0);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 11
0
        public bool UltimateTrialRP()//极限试炼红点判断
        {
            FuncTemplate m_FuncTpl = FuncTemplateManager.Instance.GetFunc(10015);

            if (m_FuncTpl.IsConditionOK())
            {
                bool rp = GetChallengeTimes() > 0;
                if (!rp)//新增竞速模式红点
                {
                    rp = GetCompeteRP();
                }
                return(rp);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 12
0
        public override void Awake()
        {
            base.Awake();

            var t = mDL.transform;

            NameLabel   = t.GetComponent <UILabel>("Label");
            TipLabel    = t.GetComponent <UILabel>("Label (1)");
            funTemplate = FuncTemplateManager.Instance.GetFunc(FunCId);

            if (funTemplate != null && !funTemplate.IsConditionOK())
            {
                if (!mDL.DataIDList.Contains("level"))
                {
                    mDL.DataIDList.Add("level");
                }

                SetBtnCondition();
            }
        }
Esempio n. 13
0
        public bool Expedition_Exp()//经验副本判断
        {
            FuncTemplate m_FuncTpl = FuncTemplateManager.Instance.GetFunc(10021);

            if (m_FuncTpl.IsConditionOK())
            {
                SpecialActivityTemplate mActivityTbl = EventTemplateManager.Instance.GetSpecialActivity(ExpActivity);
                int    times = 0;
                string path  = string.Format("special_activity.{0}.c_times", ExpActivity);
                DataLookupsCache.Instance.SearchDataByID <int>(path, out times);
                bool hasTimes = mActivityTbl.times - times > 0;
                LTRedPointSystem.Instance.SetRedPointNodeNum(RedPointConst.resourceexp, hasTimes ? 1:0);
                return(hasTimes);
            }
            else
            {
                LTRedPointSystem.Instance.SetRedPointNodeNum(RedPointConst.resourceexp, 0);
                return(false);
            }
        }
Esempio n. 14
0
        void SetRP()
        {
            if (m_Functions.Count > 0)
            {
                switch (m_Functions[0].id)
                {
                case 10015:
                {
                    m_FunctionRP.CustomSetActive(LTUltimateTrialDataManager.Instance.UltimateTrialRP());
                }
                break;

                case 10018:
                {
                    m_FunctionRP.CustomSetActive(ArenaManager.Instance.ArenaRP());
                }
                break;

                case 10068:
                {
                    bool         rp        = false;
                    FuncTemplate m_FuncTpl = FuncTemplateManager.Instance.GetFunc(10068);
                    if (m_FuncTpl.IsConditionOK())
                    {
                        int time = Mathf.Max(0, LTBountyTaskHudController.TotalHantTimes - LTBountyTaskHudController.HantTimes);
                        rp = time > 0;
                    }
                    m_FunctionRP.CustomSetActive(rp);
                }
                break;

                default: m_FunctionRP.CustomSetActive(false); break;
                }
            }

            SetRP2();
        }