/// <summary> /// Apply the filter /// </summary> private void btnApplyOrderFilter_Click(object sender, EventArgs e) { // return if object is not instantiated if (m_instrumentTradeSubscription == null) { return; } CreateInstrumentTradeSubscription(m_instrumentTradeSubscription.Instrument); // no filter to set, return if (this.cboFilter1.SelectedIndex < 0) { return; } // reset the current filters m_instrumentTradeSubscription.ClearFilter(); // create both "and" and "or" filters, setting false so the values are not negated TradeSubscriptionAndFilter andFilter = new TradeSubscriptionAndFilter(false); TradeSubscriptionOrFilter orFilter = new TradeSubscriptionOrFilter(false); // set the first filter if (this.rbAnd1.Checked) { andFilter.AddFilter(FilterFactory.Get(this.cboFilter1.SelectedIndex, this.txtFilter1.Text, m_instrumentTradeSubscription.Instrument)); } else { orFilter.AddFilter(FilterFactory.Get(this.cboFilter1.SelectedIndex, this.txtFilter1.Text, m_instrumentTradeSubscription.Instrument)); } // append additional filters if applicable if (this.cboFilter2.SelectedIndex >= 0) { if (this.rbAnd2.Checked) { andFilter.AddFilter(FilterFactory.Get(this.cboFilter2.SelectedIndex, this.txtFilter2.Text, m_instrumentTradeSubscription.Instrument)); } else { orFilter.AddFilter(FilterFactory.Get(this.cboFilter2.SelectedIndex, this.txtFilter2.Text, m_instrumentTradeSubscription.Instrument)); } } if (this.cboFilter3.SelectedIndex >= 0) { if (this.rbAnd3.Checked) { andFilter.AddFilter(FilterFactory.Get(this.cboFilter3.SelectedIndex, this.txtFilter3.Text, m_instrumentTradeSubscription.Instrument)); } else { orFilter.AddFilter(FilterFactory.Get(this.cboFilter3.SelectedIndex, this.txtFilter3.Text, m_instrumentTradeSubscription.Instrument)); } } if (this.cboFilter4.SelectedIndex >= 0) { if (this.rbAnd4.Checked) { andFilter.AddFilter(FilterFactory.Get(this.cboFilter4.SelectedIndex, this.txtFilter4.Text, m_instrumentTradeSubscription.Instrument)); } else { orFilter.AddFilter(FilterFactory.Get(this.cboFilter4.SelectedIndex, this.txtFilter4.Text, m_instrumentTradeSubscription.Instrument)); } } // add the "and" filter within the "or" filter if entries exist if (andFilter.Filters.Count > 0) { orFilter.AddFilter(andFilter); } // set the filter and restart the subscription m_instrumentTradeSubscription.SetFilter(orFilter); m_instrumentTradeSubscription.Start(); }
public LoFiFilterModel() { Name = "Lo-Fi"; Components.Enqueue(FilterFactory.CreateContrastFilter(0.5f)); Components.Enqueue(FilterFactory.CreateHueSaturationFilter(128, 64)); }
public LomoFilterModel() { Name = "Lomo"; Components.Enqueue(FilterFactory.CreateLomoFilter(0.5f, 0.75f, LomoVignetting.High, LomoStyle.Neutral)); }
//检查是否触发新手引导变化 public void OnStart(NewbieGuideButton nButton) { Global.gApp.gGameCtrl.AddGlobalTouchMask(); foreach (int nId in nButton.NewbieGuideIds) { NewbieGuideItem nConfig = Global.gApp.gGameData.NewbieGuideData.Get(nId); //引导配置是否存在 if (nConfig == null) { Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 3025, nId.ToString()); continue; } NewbieGuideItem rootConfig = Global.gApp.gGameData.NewbieGuideData.Get(nConfig.root_id); //同时只有一个引导在进行 if (m_Data.curId > 0 && Global.gApp.gGameData.NewbieGuideData.Get(m_Data.curId).root_id != nConfig.root_id) { continue; } int nState = m_Data.map[nId.ToString()]; if (nState == WeaponStateConstVal.EXIST) { continue; } //引导条件是否满足 if (nConfig.condition != null && nConfig.condition[0] != 0 && nConfig.condition.Length >= 2) { if (!FilterFactory.GetInstance().Filter(nConfig.condition)) { continue; } } //引导条件1是否满足 if (nConfig.condition1 != null && nConfig.condition1[0] != 0 && nConfig.condition1.Length >= 2) { if (!FilterFactory.GetInstance().Filter(nConfig.condition1)) { continue; } } //上个引导完成状态 if ((nConfig.id == nConfig.root_id || (nConfig.pre_id != 0 && m_Data.map[nConfig.pre_id.ToString()] == WeaponStateConstVal.EXIST)) && FilterFactory.GetInstance().JudgeNewbieButton(rootConfig.condition, nConfig, nButton)) { bool skip = false; //对于特殊情况(武器解锁引导,非主武器,如果已经有使用过了,将不再引导) if (rootConfig.condition[0] == FilterTypeConstVal.WEAPON_UNLOCK && rootConfig.condition[1] != ItemTypeConstVal.BASE_MAIN_WEAPON) { int unlockNum = 0; foreach (ItemItem cfg in Global.gApp.gGameData.ShowOrderGun[Convert.ToInt32(rootConfig.condition[1])].Values) { Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponOpenState(cfg); if (Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponOpenState(cfg.name) == WeaponStateConstVal.EXIST) { unlockNum++; if (unlockNum == rootConfig.condition[2]) { skip = true; break; } } } } if (skip) { foreach (NewbieGuideItem ni in Global.gApp.gGameData.NewbieGuideData.items) { if (ni.root_id == nConfig.root_id) { m_Data.map[ni.id.ToString()] = WeaponStateConstVal.EXIST; } } SaveData(); } else { m_Data.curId = nConfig.id; if (!string.IsNullOrEmpty(nButton.Param)) { nButton.gameObject.AddComponent <DelayCallBack>().SetAction(() => { Global.gApp.gMsgDispatcher.Broadcast(MsgIds.ChangeScrollView4Guide); }, 0.2f); } //Global.gApp.gGameCtrl.GetFrameCtrl().GetScene().GetTimerMgr().AddTimer(nConfig.delay, 1, (dt, end) => { DelayAddGameGuide(nButton, nConfig); }); nButton.gameObject.AddComponent <DelayCallBack>().SetAction(() => { DelayAddGameGuide(nButton, nConfig); }, nConfig.delay); //处理链尾 SaveData(); break; } } } Global.gApp.gGameCtrl.RemoveGlobalTouchMask(); }
public void ShouldCreateAFilterByPassingTheTypeAsAnArgument() { var filter = FilterFactory.Create(typeof(Person)); filter.Should().BeOfType(typeof(Filter <Person>)); }
protected void ButtonQuery_Click(object sender, EventArgs e) { //对GameServerManager的读权限 if (!WebUtil.CheckPrivilege(TheAdminServer.GameServerManager.SecurityObject, OpType.READ, Session)) { LabelOpMsg.Text = StringDef.NotEnoughPrivilege; LabelOpMsg.Visible = true; return; } //按流水号查询的情况(相对简明) if (QueryByWhatRadioButtonList.SelectedValue == "operationId") { Int64 operationId = Int64.Parse(OperationIdTextBox.Text); if (operationId <= 0) { LabelOpMsg.Text = "不合法的操作流水号 -- 必须为正整数"; LabelOpMsg.Visible = true; ResultDataGrid.Visible = false; return; } DbFilter operationIdFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationId, operationId); DbFilter finalFilter = operationIdFilter; //按照操作结果checkboxlist的勾选情况生成最终的finalfilter //这里将两项都勾和两项都不勾作为相同的情况处理---当作都勾 if ((resultSucessCheckBoxList.Items.FindByValue("1").Selected == true) && (resultSucessCheckBoxList.Items.FindByValue("0").Selected == false)) { DbFilter resultFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 1); finalFilter = FilterFactory.CreateAndFilter(operationIdFilter, resultFilter); } else if ((resultSucessCheckBoxList.Items.FindByValue("1").Selected == false) && (resultSucessCheckBoxList.Items.FindByValue("0").Selected == true)) { DbFilter resultFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 0); finalFilter = FilterFactory.CreateAndFilter(operationIdFilter, resultFilter); } //这里之所以需要再加一个else,是为了限定只返回operation_result字段的值为0或1的记录, //这样就过滤掉了存储最大流水号的那条特殊记录(因为其operation_result字段的值为-1) else { DbFilter resultFilter = FilterFactory.CreateOrFilter(FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 1), FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 0)); finalFilter = FilterFactory.CreateAndFilter(operationIdFilter, resultFilter); } DataTable dt = QueryAndReturnResultDataTable(finalFilter); if (dt == null) { LabelOpMsg.Text = "没有查到满足条件的记录"; LabelOpMsg.Visible = true; ResultDataGrid.Visible = false; return; } DataView dv = new DataView(dt); ResultDataGrid.DataSource = dv; ResultDataGrid.DataBind(); ResultDataGrid.Visible = true; LabelOpMsg.Visible = false; } //按操作对象查询的情况(复杂) else if (QueryByWhatRadioButtonList.SelectedValue == "target") { if (ServerGroupDropDownList.SelectedServerGroup == null) { LabelOpMsg.Text = "无操作对象"; LabelOpMsg.Visible = true; ResultDataGrid.Visible = false; return; } DbFilter finalFilter = null; //操作对象的filter if (ServerDropDownList.SelectedValue == "thisServerGroup") { int serverGroupId = ServerGroupDropDownList.SelectedServerGroup.Id; finalFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldTargetId, serverGroupId); } else { int serverId = int.Parse(ServerDropDownList.SelectedValue); finalFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldTargetId, serverId); } //平台用户的filter if (UserRadioButtonList.SelectedValue == "name") { if (UserNameTextBox.Text != String.Empty) { FSEye.Security.User user = AdminServer.TheInstance.SecurityManager.GetUser(UserNameTextBox.Text); if (user == null) { LabelOpMsg.Text = "指定的平台用户不存在"; LabelOpMsg.Visible = true; ResultDataGrid.Visible = false; return; } DbFilter userFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldUserId, user.SecurityObject.Id); finalFilter = FilterFactory.CreateAndFilter(finalFilter, userFilter); } } else if (UserRadioButtonList.SelectedValue == "id") { if (UserIdTextBox.Text != String.Empty) { int userId = int.Parse(UserIdTextBox.Text); FSEye.Security.User user = AdminServer.TheInstance.SecurityManager.GetUser(userId); if (user == null) { LabelOpMsg.Text = "指定的平台用户不存在"; LabelOpMsg.Visible = true; ResultDataGrid.Visible = false; return; } DbFilter userFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldUserId, userId); finalFilter = FilterFactory.CreateAndFilter(finalFilter, userFilter); } } //操作类型的filter if (CheckBoxListOperation.SelectedIndex != -1) { DbFilter operationTypeFilter = null; foreach (ListItem item in CheckBoxListOperation.Items) { if (item.Selected == true) { int opTypeInt = int.Parse(item.Value); DbFilter singleTypeFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationType, opTypeInt); if (operationTypeFilter == null) { operationTypeFilter = singleTypeFilter; } else { operationTypeFilter = FilterFactory.CreateOrFilter(operationTypeFilter, singleTypeFilter); } } } if (operationTypeFilter != null) { finalFilter = FilterFactory.CreateAndFilter(finalFilter, operationTypeFilter); } } //操作结果的filter if ((resultSucessCheckBoxList.Items.FindByValue("1").Selected == true) && (resultSucessCheckBoxList.Items.FindByValue("0").Selected == false)) { DbFilter resultFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 1); finalFilter = FilterFactory.CreateAndFilter(finalFilter, resultFilter); } else if ((resultSucessCheckBoxList.Items.FindByValue("1").Selected == false) && (resultSucessCheckBoxList.Items.FindByValue("0").Selected == true)) { DbFilter resultFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 0); finalFilter = FilterFactory.CreateAndFilter(finalFilter, resultFilter); } else { DbFilter resultFilter = FilterFactory.CreateOrFilter(FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 1), FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 0)); finalFilter = FilterFactory.CreateAndFilter(finalFilter, resultFilter); } //时间的filter DateTime smallerDateTime; DateTime biggerDateTime; if ((StartDate.Selected == true) && (EndDate.Selected == true)) { if (StartDate.SelectedDate <= EndDate.SelectedDate) { smallerDateTime = StartDate.SelectedDate; biggerDateTime = EndDate.SelectedDate; } else { smallerDateTime = EndDate.SelectedDate; biggerDateTime = StartDate.SelectedDate; } DbFilter timeFilter = FilterFactory.CreateAndFilter(FilterFactory.CreateLargerEqualFilter(TableString.ServerOperationLogFieldLogTime, smallerDateTime), FilterFactory.CreateLesserEqualFilter(TableString.ServerOperationLogFieldLogTime, biggerDateTime)); finalFilter = FilterFactory.CreateAndFilter(finalFilter, timeFilter); } else if ((StartDate.Selected == true) && (EndDate.Selected == false)) { DateTime now = DateTime.Now; if (StartDate.SelectedDate <= now) { smallerDateTime = StartDate.SelectedDate; biggerDateTime = now; } else { smallerDateTime = now; biggerDateTime = StartDate.SelectedDate; } DbFilter timeFilter = FilterFactory.CreateAndFilter(FilterFactory.CreateLargerEqualFilter(TableString.ServerOperationLogFieldLogTime, smallerDateTime), FilterFactory.CreateLesserEqualFilter(TableString.ServerOperationLogFieldLogTime, biggerDateTime)); finalFilter = FilterFactory.CreateAndFilter(finalFilter, timeFilter); } else if ((StartDate.Selected == false) && (EndDate.Selected == true)) { DateTime now = DateTime.Now; if (EndDate.SelectedDate <= now) { smallerDateTime = EndDate.SelectedDate; biggerDateTime = now; } else { smallerDateTime = now; biggerDateTime = EndDate.SelectedDate; } DbFilter timeFilter = FilterFactory.CreateAndFilter(FilterFactory.CreateLargerEqualFilter(TableString.ServerOperationLogFieldLogTime, smallerDateTime), FilterFactory.CreateLesserEqualFilter(TableString.ServerOperationLogFieldLogTime, biggerDateTime)); finalFilter = FilterFactory.CreateAndFilter(finalFilter, timeFilter); } //finalfilter生成完毕,可以查询了 DataTable dt = QueryAndReturnResultDataTable(finalFilter); if (dt == null) { LabelOpMsg.Text = "没有查到满足条件的记录"; LabelOpMsg.Visible = true; ResultDataGrid.Visible = false; return; } DataView dv = new DataView(dt); ResultDataGrid.DataSource = dv; ResultDataGrid.DataBind(); ResultDataGrid.Visible = true; LabelOpMsg.Visible = false; } else if (QueryByWhatRadioButtonList.SelectedValue == "time") { DbFilter finalFilter; //操作结果的filter if ((resultSucessCheckBoxList.Items.FindByValue("1").Selected == true) && (resultSucessCheckBoxList.Items.FindByValue("0").Selected == false)) { DbFilter resultFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 1); finalFilter = resultFilter; } else if ((resultSucessCheckBoxList.Items.FindByValue("1").Selected == false) && (resultSucessCheckBoxList.Items.FindByValue("0").Selected == true)) { DbFilter resultFilter = FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 0); finalFilter = resultFilter; } else { DbFilter resultFilter = FilterFactory.CreateOrFilter(FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 1), FilterFactory.CreateEqualFilter(TableString.ServerOperationLogFieldOperationResult, 0)); finalFilter = resultFilter; } //时间的filter DateTime smallerDateTime; DateTime biggerDateTime; if ((StartDate.Selected == true) && (EndDate.Selected == true)) { if (StartDate.SelectedDate <= EndDate.SelectedDate) { smallerDateTime = StartDate.SelectedDate; biggerDateTime = EndDate.SelectedDate; } else { smallerDateTime = EndDate.SelectedDate; biggerDateTime = StartDate.SelectedDate; } DbFilter timeFilter = FilterFactory.CreateAndFilter(FilterFactory.CreateLargerEqualFilter(TableString.ServerOperationLogFieldLogTime, smallerDateTime), FilterFactory.CreateLesserEqualFilter(TableString.ServerOperationLogFieldLogTime, biggerDateTime)); finalFilter = FilterFactory.CreateAndFilter(finalFilter, timeFilter); } else if ((StartDate.Selected == true) && (EndDate.Selected == false)) { DateTime now = DateTime.Now; if (StartDate.SelectedDate <= now) { smallerDateTime = StartDate.SelectedDate; biggerDateTime = now; } else { smallerDateTime = now; biggerDateTime = StartDate.SelectedDate; } DbFilter timeFilter = FilterFactory.CreateAndFilter(FilterFactory.CreateLargerEqualFilter(TableString.ServerOperationLogFieldLogTime, smallerDateTime), FilterFactory.CreateLesserEqualFilter(TableString.ServerOperationLogFieldLogTime, biggerDateTime)); finalFilter = FilterFactory.CreateAndFilter(finalFilter, timeFilter); } else if ((StartDate.Selected == false) && (EndDate.Selected == true)) { DateTime now = DateTime.Now; if (EndDate.SelectedDate <= now) { smallerDateTime = EndDate.SelectedDate; biggerDateTime = now; } else { smallerDateTime = now; biggerDateTime = EndDate.SelectedDate; } DbFilter timeFilter = FilterFactory.CreateAndFilter(FilterFactory.CreateLargerEqualFilter(TableString.ServerOperationLogFieldLogTime, smallerDateTime), FilterFactory.CreateLesserEqualFilter(TableString.ServerOperationLogFieldLogTime, biggerDateTime)); finalFilter = FilterFactory.CreateAndFilter(finalFilter, timeFilter); } //finalfilter生成完毕,可以查询了 DataTable dt = QueryAndReturnResultDataTable(finalFilter); if (dt == null) { LabelOpMsg.Text = "没有查到满足条件的记录"; LabelOpMsg.Visible = true; ResultDataGrid.Visible = false; return; } DataView dv = new DataView(dt); ResultDataGrid.DataSource = dv; ResultDataGrid.DataBind(); ResultDataGrid.Visible = true; LabelOpMsg.Visible = false; } }
public void UpdateQualityLv(ItemItem itemConfig, Action <int> resultCallBack) { WeaponItemDTO itemDTO; if (m_Data.weaponMap.TryGetValue(itemConfig.name, out itemDTO)) { if (itemDTO.qualityLv == 0) { bool isSucess = true; for (int i = 0; i < 2; i++) { float[] condition = new float[] { itemConfig.supercondition[0], itemConfig.supercondition[i * 2 + 1], itemConfig.supercondition[i * 2 + 2], }; isSucess = isSucess && FilterFactory.GetInstance().Filter(condition); if (!isSucess) { ItemItem reduceCfg = Global.gApp.gGameData.ItemData.Get(Convert.ToInt32(condition[1])); Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 1008, Global.gApp.gGameData.GetTipsInCurLanguage(reduceCfg.sourceLanguage)); break; } } if (isSucess) { ItemDTO reduceItemDTO = new ItemDTO(Convert.ToInt32(itemConfig.supercondition[1]), itemConfig.supercondition[2], BehaviorTypeConstVal.OPT_CAMP_UPGRADE_QUALITY); reduceItemDTO.paramStr1 = itemConfig.name; reduceItemDTO.paramStr2 = itemDTO.qualityLv.ToString(); GameItemFactory.GetInstance().ReduceItem(reduceItemDTO); if (reduceItemDTO.result) { ItemDTO reduceItemDTO2 = new ItemDTO(Convert.ToInt32(itemConfig.supercondition[3]), itemConfig.supercondition[4], BehaviorTypeConstVal.OPT_CAMP_UPGRADE_QUALITY); reduceItemDTO2.paramStr1 = itemConfig.name; reduceItemDTO.paramStr2 = itemDTO.qualityLv.ToString(); GameItemFactory.GetInstance().ReduceItem(reduceItemDTO2); if (reduceItemDTO2.result) { itemDTO.qualityLv++; SaveData(); resultCallBack(0); } else { resultCallBack(1008); } } else { resultCallBack(1008); } } else { resultCallBack(1008); } } else { resultCallBack(1008); } } else { resultCallBack(1008); } }
public void Given_OperatorIsNotValid_Should_LogWarningOnce(string filter) { var result = FilterFactory <TestPoco> .Create(nameof(TestPoco.StringProp), filter, Logger); MockLogger.VerifyLogging(LogLevel.Warning, Times.Once()); }
public void Given_ValueDoesNotCastToNamedColumnType_Should_ReturnFilterWithIsValidEqualsFalse(string propertyName) { var result = FilterFactory <TestPoco> .Create(propertyName, ValueDoesNotCastToNamedColumnTypeValue, Logger); Assert.That(result.IsValid, Is.EqualTo(false)); }
public void Given_OperatorIsNotValid_Should_ReturnFilterWithIsValidEqualsFalse(string filter) { var result = FilterFactory <TestPoco> .Create(nameof(TestPoco.StringProp), filter, Logger); Assert.That(result.IsValid, Is.EqualTo(false)); }
public void Given_OperatorIsNotValid_Should_ReturnFilterWithErrorMessageValue(string filter) { var result = FilterFactory <TestPoco> .Create(nameof(TestPoco.StringProp), filter, Logger); Assert.That(result.ErrorMessage, Is.Not.Null); }
public void Given_ColumNameIsNotValidProperty_Should_LogWarningOnce(string propertyName) { var result = FilterFactory <TestPoco> .Create(propertyName, string.Empty, Logger); MockLogger.VerifyLogging(LogLevel.Warning, Times.Once()); }
public void Given_ColumNameIsNotValidProperty_Should_ReturnFilterWithErrorMessageValue(string propertyName) { var result = FilterFactory <TestPoco> .Create(propertyName, string.Empty, Logger); Assert.That(result.ErrorMessage, Is.Not.Null); }
public void Given_ColumNameIsNotValidProperty_Should_ReturnFilterWithIsValidEqualsFalse(string propertyName) { var result = FilterFactory <TestPoco> .Create(propertyName, string.Empty, Logger); Assert.That(result.IsValid, Is.EqualTo(false)); }
public void Given_LikeFilterWithNonStringColumn_Should_LogWarningOnce(string propertyName) { var result = FilterFactory <TestPoco> .Create(propertyName, $"like:hello*", Logger); MockLogger.VerifyLogging(LogLevel.Warning, Times.Once()); }
public void FilterFactoryConstructorTest() { FilterFactory target = new FilterFactory(); Assert.IsInstanceOfType(target, typeof(FilterFactory)); }
/// <summary> /// Begins a photo stream item rendering process loop. Loop is executed asynchronously item by item /// until there are no more items in the queue. /// </summary> private async void Process() { _processingNow++; while (_enabled && Count > 0) { StreamItemViewModel item; if (_priorityQueue.Count > 0) { Busy = true; item = _priorityQueue[0]; _priorityQueue.RemoveAt(0); } else { item = _standardQueue[0]; _standardQueue.RemoveAt(0); } try { WriteableBitmap bitmap = null; using (MemoryStream thumbnailStream = new MemoryStream()) { System.Diagnostics.Debug.Assert(item.RequestedSize != StreamItemViewModel.Size.None); if (item.RequestedSize == StreamItemViewModel.Size.Large) { bitmap = new WriteableBitmap(280, 280); item.Model.Picture.GetImage().CopyTo(thumbnailStream); } else if (item.RequestedSize == StreamItemViewModel.Size.Medium) { bitmap = new WriteableBitmap(140, 140); item.Model.Picture.GetThumbnail().CopyTo(thumbnailStream); } else { bitmap = new WriteableBitmap(70, 70); item.Model.Picture.GetThumbnail().CopyTo(thumbnailStream); } using (EditingSession session = new EditingSession(thumbnailStream.GetWindowsRuntimeBuffer())) { Windows.Foundation.Rect rect; if (session.Dimensions.Width > session.Dimensions.Height) { rect = new Windows.Foundation.Rect() { Width = session.Dimensions.Height, Height = session.Dimensions.Height, X = session.Dimensions.Width / 2 - session.Dimensions.Height / 2, Y = 0 }; } else { rect = new Windows.Foundation.Rect() { Width = session.Dimensions.Width, Height = session.Dimensions.Width, X = 0, Y = session.Dimensions.Height / 2 - session.Dimensions.Width / 2 }; } session.AddFilter(FilterFactory.CreateCropFilter(rect)); if (item.Model.Filter != null) { foreach (IFilter f in item.Model.Filter.Components) { session.AddFilter(f); } } await session.RenderToBitmapAsync(bitmap.AsBitmap()); } } item.TransitionToImage(bitmap); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Rendering stream item failed:" + ex.Message); item.TransitionToImage(null); } } _processingNow--; if (_processingNow == 0) { Busy = false; } }
private void Init() { _filterFactory = new FilterFactory(RequestFilterSection.Instance); _filters = _filterFactory.BuildFiltersFromConfig(); _processor = new RequestProcessor(_filters); }
static int Main(string[] args) { if (args.Length < 2) { Console.WriteLine("Usage: MakeNLogXSD outputfile.xsd path_to_doc.xml"); return(1); } try { _docXml.Load(args[1]); for (int i = 2; i < args.Length; ++i) { try { Assembly asm = Assembly.Load(args[i]); TargetFactory.AddTargetsFromAssembly(asm, ""); LayoutRendererFactory.AddLayoutRenderersFromAssembly(asm, ""); FilterFactory.AddFiltersFromAssembly(asm, ""); LayoutFactory.AddLayoutsFromAssembly(asm, ""); } catch (Exception ex) { Console.WriteLine("WARNING: {0}", ex.Message); } } StringWriter sw = new StringWriter(); sw.Write("<root xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.Namespaces = false; xtw.Formatting = Formatting.Indented; _typeDumped[typeof(object)] = 1; _typeDumped[typeof(Target)] = 1; _typeDumped[typeof(TargetWithLayout)] = 1; _typeDumped[typeof(TargetWithLayoutHeaderAndFooter)] = 1; _typeDumped[typeof(ILayout)] = 1; _typeDumped[typeof(ILayoutWithHeaderAndFooter)] = 1; foreach (Type targetType in NLog.TargetFactory.TargetTypes) { DumpType(xtw, targetType); } foreach (Type t in FilterFactory.FilterTypes) { DumpType(xtw, t); } foreach (Type t in LayoutFactory.LayoutTypes) { DumpType(xtw, t); } xtw.Flush(); sw.Write("</root>"); sw.Flush(); XmlDocument doc2 = new XmlDocument(); doc2.LoadXml(sw.ToString()); using (Stream templateStream = Assembly.GetEntryAssembly().GetManifestResourceStream("MakeNLogXSD.TemplateNLog.xsd")) { XmlDocument doc = new XmlDocument(); doc.Load(templateStream); XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("", "http://www.w3.org/2001/XMLSchema"); XmlNode n = doc.SelectSingleNode("//types-go-here"); foreach (XmlElement el in doc2.DocumentElement.ChildNodes) { XmlNode importedNode = doc.ImportNode(el, true); n.ParentNode.InsertBefore(importedNode, n); } n.ParentNode.RemoveChild(n); n = doc.SelectSingleNode("//filters-go-here"); foreach (Type t in FilterFactory.FilterTypes) { FilterAttribute fa = (FilterAttribute)Attribute.GetCustomAttribute(t, typeof(FilterAttribute)); XmlElement el = doc.CreateElement("xs:element", XmlSchema.Namespace); el.SetAttribute("name", fa.Name); el.SetAttribute("type", SimpleTypeName(t)); n.ParentNode.InsertBefore(el, n); } n.ParentNode.RemoveChild(n); Console.WriteLine("Saving schema to: {0}", args[0]); doc.Save(args[0]); return(0); } } catch (Exception ex) { Console.WriteLine("ERROR: {0}", ex); return(1); } }
private void AddFilter() { this.Filters.Add(FilterFactory.CreateFilter(this.SelectedFilterType, this.Samplerate, this.Signals)); }
//点击事件 public void OnClick(NewbieGuideButton nButton) { Global.gApp.gGameCtrl.AddGlobalTouchMask(); foreach (int nId in nButton.NewbieGuideIds) { NewbieGuideItem nConfig = Global.gApp.gGameData.NewbieGuideData.Get(nId); //引导配置是否存在 if (nConfig == null) { Global.gApp.gMsgDispatcher.Broadcast <int, string>(MsgIds.ShowGameTipsByIDAndParam, 3025, nId.ToString()); continue; } NewbieGuideItem rootConfig = Global.gApp.gGameData.NewbieGuideData.Get(nConfig.root_id); //同时只有一个引导在进行 if (m_Data.curId > 0 && Global.gApp.gGameData.NewbieGuideData.Get(m_Data.curId).root_id != nConfig.root_id) { continue; } int nState = m_Data.map[nId.ToString()]; if (nState == WeaponStateConstVal.EXIST) { continue; } //引导条件是否满足 if (nConfig.condition != null && nConfig.condition[0] != 0 && nConfig.condition.Length >= 2) { if (!FilterFactory.GetInstance().Filter(nConfig.condition)) { continue; } } //引导条件1是否满足 if (nConfig.condition1 != null && nConfig.condition1[0] != 0 && nConfig.condition1.Length >= 2) { if (!FilterFactory.GetInstance().Filter(nConfig.condition1)) { continue; } } //上个引导完成状态 if ((nConfig.id == nConfig.root_id || (nConfig.pre_id != 0 && m_Data.map[nConfig.pre_id.ToString()] == WeaponStateConstVal.EXIST)) && FilterFactory.GetInstance().JudgeNewbieButton(rootConfig.condition, nConfig, nButton)) { Global.gApp.gMsgDispatcher.Broadcast <Transform>(MsgIds.rmGameGuideUi, nButton.NewbieButton.transform); Global.gApp.gMsgDispatcher.Broadcast(MsgIds.RmGuidePlotUi); m_Data.map[nConfig.id.ToString()] = WeaponStateConstVal.EXIST; SaveData(); //处理链尾 if (nConfig.post_id != 0) { NewbieGuideItem postConfig = Global.gApp.gGameData.NewbieGuideData.Get(nConfig.post_id); int postState = m_Data.map[nConfig.post_id.ToString()]; //链尾只有文本提示文本 if (postConfig.post_id == 0 && postConfig.onlyText == 1) { m_Data.curId = 0; m_Data.map[nConfig.post_id.ToString()] = WeaponStateConstVal.EXIST; //Global.gApp.gGameCtrl.GetFrameCtrl().GetScene().GetTimerMgr().AddTimer(nConfig.delay, 1, (dt, end) => //{ Global.gApp.gMsgDispatcher.Broadcast<int, float, bool, bool>(MsgIds.AddGuidePlotUi, postConfig.tips, postConfig.tips_y, true, false); }); nButton.gameObject.AddComponent <DelayCallBack>().SetAction(() => { Global.gApp.gMsgDispatcher.Broadcast <int, float, bool, bool>(MsgIds.AddGuidePlotUi, postConfig.tips, postConfig.tips_y, true, false); }, postConfig.delay); SaveData(); } NewbieGuideButton[] newBieButtons = nButton.transform.parent.GetComponentsInChildren <NewbieGuideButton>(); foreach (NewbieGuideButton newBieButton in newBieButtons) { OnStart(newBieButton); } } else { m_Data.curId = 0; SaveData(); } break; } } Global.gApp.gGameCtrl.RemoveGlobalTouchMask(); }
public TModel ToModel <TModel, TInterfaceConstraint>(IComponentContext container, bool lazyLoading = false, int level = 0) where TModel : TInterfaceConstraint, new() { TModel model = new TModel(); Type t = typeof(TModel); Type c = this.GetType(); try { foreach (var propInfo in t.GetProperties()) { var attr = propInfo.GetCustomAttributes(true).OfType <ColumnDefinitionAttribute>().FirstOrDefault(); if (attr != null && attr.EnumType == null && !string.IsNullOrEmpty(attr.EntityProperty) && c.GetProperty(attr.EntityProperty) != null && (string.IsNullOrEmpty(attr.DisplayValue) || string.IsNullOrEmpty(attr.DisplayText)) && ((attr.Load && attr.Level >= level) || attr.Load || !lazyLoading)) { try { var entity = c.GetProperty(attr.EntityProperty).GetValue(this, null); if (entity != null && entity.GetType().GetInterfaces().Count(i => i.Name.Contains("ICollection")) > 0) { var parentKeyValue = new KeyValue { Key = this.Id, Value = string.Format("{0}Id", model.GetType().Name) }; AInBox.Astove.Core.Options.Filter filter = FilterFactory.GenerateFilter(container, null, propInfo.PropertyType.GetGenericArguments()[0], parentKeyValue); var miTPList = typeof(ICollectionExtensions).GetMethod("ToPaginatedList"); var miToPaginatedList = miTPList.MakeGenericMethod(new[] { entity.GetType().GetGenericArguments()[0] }); // Setting parentId var paginatedList = miToPaginatedList.Invoke(entity, new object[] { entity, container, filter, parentKeyValue, 1, DataEntityAttribute.DefaultPageSizes[0] }); var mi = typeof(PaginatedList <>).MakeGenericType(entity.GetType().GetGenericArguments()[0]).GetMethod("ToPaginatedModel"); var miToPaginatedModel = mi.MakeGenericMethod(new[] { propInfo.PropertyType.GetGenericArguments()[0] }); var paginatedModel = miToPaginatedModel.Invoke(paginatedList, new object[] { attr.WhereClause, attr.OrderBy }); propInfo.SetValue(model, paginatedModel, null); } else if (entity != null) { entity = (BaseEntity)entity; var interfaceConstraintType = typeof(IBindingModel); if (propInfo.PropertyType.IsAssignableTo <IModel>()) { interfaceConstraintType = typeof(IModel); } else if (propInfo.PropertyType.IsAssignableTo <IMongoModel>()) { interfaceConstraintType = typeof(IMongoModel); } var methodInfo = c.GetMethod("ToModel"); var toModelMethod = methodInfo.MakeGenericMethod(new[] { propInfo.PropertyType, interfaceConstraintType }); var obj = toModelMethod.Invoke(entity, new object[] { container, true, level + 1 }); propInfo.SetValue(model, obj, null); } } catch { throw new Exception(string.Format("Falha ao obter um objeto de navegação, propriedade {0} do tipo {1} do modelo {2}", propInfo.Name, propInfo.PropertyType.Name, typeof(TModel).Name)); } } else if (attr != null && attr.EnumType == null && !string.IsNullOrEmpty(attr.EntityProperty) && (c.GetProperty(attr.EntityProperty) == null || (!string.IsNullOrEmpty(attr.DisplayValue) && !string.IsNullOrEmpty(attr.DisplayText))) && ((attr.Load && attr.Level >= level) || attr.Load || !lazyLoading)) { try { if (attr.EntityProperty.Contains(".")) { this.SetValue(model, propInfo, attr.EntityProperty); continue; } var ts = typeof(IEntityService <>); var entityType = Type.GetType(string.Format(System.Web.Configuration.WebConfigurationManager.AppSettings["DataAssemblyFormat"], attr.EntityProperty)); var serviceType = ts.MakeGenericType(new[] { entityType }); var service = container.Resolve(serviceType); if (propInfo.PropertyType == typeof(DropDownOptions) && !string.IsNullOrEmpty(attr.DisplayValue) && !string.IsNullOrEmpty(attr.DisplayText)) { SetDropDownOptions <TModel, TInterfaceConstraint>(model, container, propInfo, this); } else if (propInfo.PropertyType == typeof(DropDownStringOptions)) { ((IEntityService <BaseEntity>)service).MongoService.SetDropDownOptions <TModel>(model); } else if (propInfo.PropertyType.GetInterfaces().Count(i => i.Name.Contains("ICollection")) > 0) { var entities = service.GetType().GetMethod("GetEntities", new Type[] { }).Invoke(service, null); var list = Activator.CreateInstance(typeof(HashSet <>).MakeGenericType(propInfo.PropertyType.GetGenericArguments()[0])); foreach (var obj in (IEnumerable)entities) { var methodInfo = obj.GetType().GetMethod("ToModel"); var toModelMethod = methodInfo.MakeGenericMethod(new[] { propInfo.PropertyType.GetGenericArguments()[0] }); var modelObj = toModelMethod.Invoke(obj, new object[] { container, true, level + 1 }); var miAdd = list.GetType().GetMethod("Add"); miAdd.Invoke(list, new object[] { modelObj }); } propInfo.SetValue(model, list, null); } } catch { throw new Exception(string.Format("Falha ao obter um objeto de navegação auxiliar, propriedade {0} do tipo {1} do modelo {2}", propInfo.Name, propInfo.PropertyType.Name, typeof(TModel).Name)); } } else if (attr != null && attr.EnumType != null && !string.IsNullOrEmpty(attr.Field)) { try { var enumText = AInBox.Astove.Core.Enums.EnumUtility.GetEnumText(attr.EnumType, Convert.ToInt32(c.GetProperty(propInfo.Name).GetValue(this, null))); t.GetProperty(attr.Field.ToPascalCase()).SetValue(model, enumText, null); propInfo.SetValue(model, c.GetProperty(propInfo.Name).GetValue(this, null), null); } catch { throw new Exception(string.Format("Falha ao obter um enum, propriedade {0} do tipo {1} do modelo {2}", propInfo.Name, propInfo.PropertyType.Name, typeof(TModel).Name)); } } else if (c.GetProperty(propInfo.Name) != null) { try { if (!propInfo.PropertyType.BaseType.Name.Equals("Array") && !propInfo.Name.Equals("Id")) { //propInfo.SetValue(model, c.GetProperty(propInfo.Name).GetValue(this, null), null); this.SetValue(model, propInfo); } else if (propInfo.Name.Equals("Id")) { var propParentId = t.GetProperty("ParentId"); if (propParentId != null) { propParentId.SetValue(model, Convert.ToString(c.GetProperty(propInfo.Name).GetValue(this, null)), null); } } } catch { throw new Exception(string.Format("Falha ao obter a propriedade {0} do tipo {1} do modelo {2}", propInfo.Name, propInfo.PropertyType.Name, typeof(TModel).Name)); } } } } catch (Exception ex) { throw ex; } return(model); }
public void UIFresh() { if (m_ItemConfig == null) { return; } if (Global.gApp.gSystemMgr.GetWeaponMgr().GetCurMainWeapon().Equals(m_ItemConfig.name)) { Equip.gameObject.SetActive(true); EquipBg.gameObject.SetActive(true); } else { Equip.gameObject.SetActive(false); EquipBg.gameObject.SetActive(false); } if (Global.gApp.gSystemMgr.GetWeaponMgr().GetQualityLv(m_ItemConfig) == 0) { WeaponIcon.image.sprite = Resources.Load(m_ItemConfig.image_grow, typeof(Sprite)) as Sprite; } else { WeaponIcon.image.sprite = Resources.Load(m_ItemConfig.image_grow + "_s", typeof(Sprite)) as Sprite; } WeaponNameTxt.text.text = m_ItemConfig.gamename; gameObject.SetActive(true); UnlockBtn.gameObject.SetActive(false); if (!Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponOpenState(m_ItemConfig)) { if (m_ItemConfig.opencondition[0] == FilterTypeConstVal.CUR_ITEM_NUM) { Mask1.gameObject.SetActive(true); MaskTxt.gameObject.SetActive(false); MaskTxt.text.text = FilterFactory.GetInstance().GetUnfinishTips(m_ItemConfig.opencondition); UnlockBtn.gameObject.SetActive(true); u_CmNum.text.text = UiTools.FormateMoney(m_ItemConfig.opencondition[2]); u_CmNum.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem((int)m_ItemConfig.opencondition[1]) < m_ItemConfig.opencondition[2], null); u_CmIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, m_ItemConfig.opencondition[1])); } else { Mask1.gameObject.SetActive(true); MaskTxt.gameObject.SetActive(true); MaskTxt.text.text = FilterFactory.GetInstance().GetUnfinishTips(m_ItemConfig.opencondition); } Equip.gameObject.SetActive(false); EquipBg.gameObject.SetActive(false); WeaponNameTxt.gameObject.SetActive(false); WeaponLvTxt.gameObject.SetActive(false); Param1NameTxt.gameObject.SetActive(false); UpBtn.gameObject.SetActive(false); WeaponIcon.image.color = ColorUtil.GetColor(ColorUtil.m_BlackColor); } else { Mask1.gameObject.SetActive(false); WeaponNameTxt.gameObject.SetActive(true); WeaponLvTxt.gameObject.SetActive(true); Param1NameTxt.gameObject.SetActive(true); UpBtn.gameObject.SetActive(true); WeaponIcon.image.color = ColorUtil.GetColor(ColorUtil.m_DeaultColor); //新获得的武器显示特效 if (Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponOpenState(m_ItemConfig.name) == WeaponStateConstVal.NEW) { NewWeapon.gameObject.SetActive(true); NewIMG.gameObject.SetActive(true); } } int gunLevel = Global.gApp.gSystemMgr.GetWeaponMgr().GetWeaponLevel(m_ItemConfig.name); Guns_dataItem weaponLevelData = Global.gApp.gGameData.GunDataConfig.Get(gunLevel); double[] costValue = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(m_ItemConfig.name + "_cost", weaponLevelData); if ((int)costValue[0] != SpecialItemIdConstVal.REAL_MONEY) { CmNum.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem((int)costValue[0]) < costValue[1], m_CM_COLOR); } //可升级提示 if (Global.gApp.gSystemMgr.GetWeaponMgr().CanUpdateWeapon(m_ItemConfig)) { WeaponUp.gameObject.SetActive(true); } else { WeaponUp.gameObject.SetActive(false); } Guns_dataItem nextLevelCfg = Global.gApp.gGameData.GunDataConfig.Get(gunLevel + 1); double[] weaponParams = null; if (nextLevelCfg != null) { weaponParams = ReflectionUtil.GetValueByProperty <Guns_dataItem, double[]>(m_ItemConfig.name, nextLevelCfg); } bool max = weaponParams == null || weaponParams.Length == 0; CmIcon.gameObject.SetActive(!max); CmNum.gameObject.SetActive(!max); dotxt.gameObject.SetActive(!max); MaxTxt.gameObject.SetActive(max); if (m_ItemConfig.opencondition[0] == FilterTypeConstVal.WEAPON_UNLOCK) { u_CmNum.text.text = UiTools.FormateMoney(m_ItemConfig.opencondition[2]); u_CmNum.text.color = ColorUtil.GetTextColor(GameItemFactory.GetInstance().GetItem((int)m_ItemConfig.opencondition[1]) < m_ItemConfig.opencondition[2], null); u_CmIcon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(string.Format(CommonResourceConstVal.RESOURCE_PATH, m_ItemConfig.opencondition[1])); } }
public bool prepare(Options options, Scene scene, int w, int h) { this.scene = scene; imageWidth = w; imageHeight = h; // fetch options bucketSize = options.getInt("bucket.size", bucketSize); bucketOrderName = options.getstring("bucket.order", bucketOrderName); minAADepth = options.getInt("aa.min", minAADepth); maxAADepth = options.getInt("aa.max", maxAADepth); superSampling = options.getInt("aa.samples", superSampling); displayAA = options.getbool("aa.display", displayAA); jitter = options.getbool("aa.jitter", jitter); contrastThreshold = options.getFloat("aa.contrast", contrastThreshold); // limit bucket size and compute number of buckets in each direction bucketSize = MathUtils.clamp(bucketSize, 16, 512); int numBucketsX = (imageWidth + bucketSize - 1) / bucketSize; int numBucketsY = (imageHeight + bucketSize - 1) / bucketSize; bucketOrder = BucketOrderFactory.create(bucketOrderName); bucketCoords = bucketOrder.getBucketSequence(numBucketsX, numBucketsY); // validate AA options minAADepth = MathUtils.clamp(minAADepth, -4, 5); maxAADepth = MathUtils.clamp(maxAADepth, minAADepth, 5); superSampling = MathUtils.clamp(superSampling, 1, 256); invSuperSampling = 1.0 / superSampling; // compute AA stepping sizes subPixelSize = (maxAADepth > 0) ? (1 << maxAADepth) : 1; minStepSize = maxAADepth >= 0 ? 1 : 1 << (-maxAADepth); if (minAADepth == maxAADepth) { maxStepSize = minStepSize; } else { maxStepSize = minAADepth > 0 ? 1 << minAADepth : subPixelSize << (-minAADepth); } useJitter = jitter && maxAADepth > 0; // compute anti-aliasing contrast thresholds contrastThreshold = MathUtils.clamp(contrastThreshold, 0, 1); thresh = contrastThreshold * (float)Math.Pow(2.0f, minAADepth); // read filter settings from scene filterName = options.getstring("filter", filterName); filter = FilterFactory.get(filterName); // adjust filter if (filter == null) { UI.printWarning(UI.Module.BCKT, "Unrecognized filter type: \"{0}\" - defaulting to box", filterName); filter = new BoxFilter(1); filterName = "box"; } fhs = filter.getSize() * 0.5f; fs = (int)Math.Ceiling(subPixelSize * (fhs - 0.5f)); // prepare QMC sampling sigma = QMC.generateSigmaTable(subPixelSize << 7); UI.printInfo(UI.Module.BCKT, "Bucket renderer settings:"); UI.printInfo(UI.Module.BCKT, " * Resolution: {0}x{1}", imageWidth, imageHeight); UI.printInfo(UI.Module.BCKT, " * Bucket size: {0}", bucketSize); UI.printInfo(UI.Module.BCKT, " * Number of buckets: {0}x{1}", numBucketsX, numBucketsY); if (minAADepth != maxAADepth) { UI.printInfo(UI.Module.BCKT, " * Anti-aliasing: {0} -> {1} (adaptive)", aaDepthTostring(minAADepth), aaDepthTostring(maxAADepth)); } else { UI.printInfo(UI.Module.BCKT, " * Anti-aliasing: {0} (fixed)", aaDepthTostring(minAADepth)); } UI.printInfo(UI.Module.BCKT, " * Rays per sample: {0}", superSampling); UI.printInfo(UI.Module.BCKT, " * Subpixel jitter: {0}", useJitter ? "on" : (jitter ? "auto-off" : "off")); UI.printInfo(UI.Module.BCKT, " * Contrast threshold: {0}", contrastThreshold); UI.printInfo(UI.Module.BCKT, " * Filter type: {0}", filterName); UI.printInfo(UI.Module.BCKT, " * Filter size: {0} pixels", filter.getSize()); return(true); }
public OverExposureFilterModel() { Name = "Over Exposure"; Components.Enqueue(FilterFactory.CreateExposureFilter(ExposureMode.Natural, 0.2)); }
public ModelReaderFactory(IApplicationConfig config, FilterFactory filterFactory) { _config = config; _filterFactory = filterFactory; }
public GrayscaleFilterModel() { Name = "Grayscale"; Components.Enqueue(FilterFactory.CreateGrayscaleFilter()); }
//通常的逻辑(最近的Soilder),特殊情况重写此函数 public override IFilter DesignFilter() { return(FilterFactory.getNormalFilterForEnemy(this)); }
public SepiaFilterModel() { Name = "Sepia"; Components.Enqueue(FilterFactory.CreateSepiaFilter()); }
public override void Init <T>(string name, UIInfo info, T arg) { base.Init(name, info, arg); m_NextGunCfg = arg as ItemItem; bool isWeapon = ItemTypeConstVal.isWeapon(m_NextGunCfg.showtype); NextGunName.gameObject.SetActive(isWeapon); NextGunIcon.gameObject.SetActive(isWeapon); //NextGunDown.gameObject.SetActive(isWeapon); NextAwardIcon.gameObject.SetActive(!isWeapon); if (isWeapon) { TitleTxt.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(3083); GeneralConfigItem colorConfig = Global.gApp.gGameData.GeneralConfigData.Get(GeneralConfigConstVal.QUALITY_COLOR); NextGunName.text.text = m_NextGunCfg.gamename; NextGunIcon.image.sprite = Resources.Load(m_NextGunCfg.image_grow, typeof(Sprite)) as Sprite; if (m_NextGunCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON) { NextGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, m_NextGunCfg.qualevel), typeof(Sprite)) as Sprite; NextGunName.text.color = ColorUtil.GetColor(colorConfig.contents[m_NextGunCfg.qualevel]); } else { NextGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; NextGunName.text.color = ColorUtil.GetColor(colorConfig.contents[2]); } //NextGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, m_NextGunCfg.qualevel), typeof(Sprite)) as Sprite; EffectItem effectItem = Global.gApp.gGameData.EffectData.Get(EffectConstVal.QUALITY); string effectName = m_NextGunCfg.showtype == ItemTypeConstVal.BASE_MAIN_WEAPON ? m_NextGunCfg.qualevel.ToString() : "common"; m_Effect = UiTools.GetEffect(string.Format(effectItem.path, effectName), NextDay.rectTransform); Destxt.text.text = FilterFactory.GetInstance().GetMiddleUnfinishTips(m_NextGunCfg.opencondition); LeftTxt.text.text = FilterFactory.GetInstance().GetLeftTips(m_NextGunCfg.opencondition); m_Effect.transform.GetChild(0).localPosition = new Vector3(0f, 0f, 0f); ParticleSystem[] pss = m_Effect.GetComponentsInChildren <ParticleSystem>(); foreach (ParticleSystem ps in pss) { ps.GetComponent <Renderer>().sortingOrder = 45; } } else { TitleTxt.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(3084); QuestItemDTO nextLevelDetailDTO = Global.gApp.gSystemMgr.GetQuestMgr().GetNextLevelDetailQuest(); QuestItem questCfg = Global.gApp.gGameData.QuestData.Get(nextLevelDetailDTO.id); NextAwardIcon.image.sprite = Resources.Load(questCfg.awardIcon, typeof(Sprite)) as Sprite; Destxt.text.text = FilterFactory.GetInstance().GetMiddleUnfinishTips(questCfg.condition); LeftTxt.text.text = FilterFactory.GetInstance().GetLeftTips(questCfg.condition); NextGunDown.image.sprite = Resources.Load(string.Format(CommonResourceConstVal.MAIN_UI_WEAPON_DOWN_PATH, 2), typeof(Sprite)) as Sprite; } Btn2.button.onClick.AddListener(TouchClose); BtnC.button.onClick.AddListener(TouchClose); base.ChangeLanguage(); }
/// <summary> /// Create new condition /// </summary> /// <typeparam name="TEntity">Type of entity associated to column name</typeparam> /// <param name="columnName">Column Name involve</param> /// <param name="value">Value to compare to column name</param> /// <param name="filterOperator">Operator to apply</param> /// <returns>New build condition</returns> public ICondition Condition <TEntity>(string columnName, object value, FilterOperator filterOperator) { return(FilterFactory.Condition <TEntity>(columnName, value, filterOperator)); }
/** * Adds a filter type so that createFilterByType() can be called to create * filter instances. * * @param type * Type name of the filter factory to install * @param factory * Factory that will create instances of the filter type * @return * True upon success, false upon failure */ public bool addFilterType(string type, FilterFactory factory) { string n = normalize(type); filter_factories[n] = factory; //TODO osgGIS.notify( osg.DEBUG_INFO ) << "osgGIS.Registry: Registered filter type " << type << std.endl; return true; }