protected CattleGetter(int amount, PopType popType, Culture culture, Province where) : base(amount, popType, culture, where) { //storage = new Storage(Product.Cattle); //gainGoodsThisTurn = new Storage(Product.Cattle); //sentToMarket = new Storage(Product.Cattle); changeProductionType(Product.Cattle); }
public Pop(PopType type, int size, string culture, string religion) { Type = type; Size = size; Culture = culture; Religion = religion; }
protected CattleGetter(PopUnit source, int sizeOfNewPop, PopType newPopType, Province where, Culture culture, IWayOfLifeChange oldLife) : base(source, sizeOfNewPop, newPopType, where, culture, oldLife) { //storage = new Storage(Product.Cattle); //gainGoodsThisTurn = new Storage(Product.Cattle); //sentToMarket = new Storage(Product.Cattle); changeProductionType(Product.Cattle); }
/// <summary> /// 选择类型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnType_Press(object sender, EventArgs e) { try { PopType.Groups.Clear(); PopListGroup typeGroup = new PopListGroup(); typeGroup.Title = "资产类型"; var typelist = _autofacConfig.assTypeService.GetAll(); foreach (var type in typelist) { PopListItem item = new PopListItem { Value = type.TYPEID, Text = type.NAME }; typeGroup.Items.Add(item); } PopType.Groups.Add(typeGroup); if (!string.IsNullOrEmpty(btnType.Text)) { foreach (PopListItem row in PopType.Groups[0].Items) { if (row.Text == btnType.Text) { PopType.SetSelections(row); } } } PopType.ShowDialog(); } catch (Exception ex) { Toast(ex.Message); } }
public void SetPopState(PopType type, bool b) { isShow[(int)type] = b; if (b == false) { //NetworkManager.Instance.UserInfo(); } }
public void Pop(PopType popType) { // Enable animations Animator animator = GetComponentInChildren<Animator>(); animator.SetBool("IsOpen", true); innerBox.SetActive(false); switch (popType) { case PopType.POP_GOOD: popup = goodPopup; bool rollFireworks = false; // Start animations fireworksController.StartFireworks(rollFireworks); StartCoroutine(YPositionCoroutine(popup, popupGoodNode, fireworksController.transform, 0.15f)); StartCoroutine(AlphaCoroutine(popup, 1.0f, 0.0f, 1.0f, 0.0f)); break; case PopType.POP_BAD: popup = badPopup; const float amountHeart = 0.8f; const float amountWord = 0.4f; fireworksController.DestroyFireworks(); // Start animations StartCoroutine(YPositionCoroutine(badPopupHeart, popup.transform.position, amountHeart, 0.25f)); StartCoroutine(YPositionCoroutine(badPopupWord, popup.transform.position, amountWord, 0.25f)); StartCoroutine(AlphaCoroutine(badPopupHeart, 1.0f, 0.0f, 1.0f, 0.4f)); StartCoroutine(AlphaCoroutine(badPopupWord, 1.0f, 0.0f, 0.1f, 0.4f)); break; case PopType.POP_MISS: popup = missPopup; float amountY = 0.2f; fireworksController.DestroyFireworks(); // Start animations StartCoroutine(YPositionCoroutine(missPopupNote, missPopupNote.transform.position, amountY, 0.15f)); StartCoroutine(YPositionCoroutine(missPopupDots, missPopupDots.transform.position, amountY, 0.15f)); StartCoroutine(AlphaCoroutine(missPopupNote, 0.0f, 1.0f, 0.1f, 0.0f)); StartCoroutine(AlphaCoroutine(missPopupDots, 1.0f, 0.0f, 0.2f, 0.1f)); StartCoroutine(AlphaCoroutine(missPopupCircle, 1.0f, 0.0f, 0.1f, 0.0f)); break; case PopType.POP_FIREWORKS: RollFireworks(); break; case PopType.POP_EMPTY: fireworksController.DestroyFireworks(); break; default: Debug.Log("Unknown pop type " + popType); break; } if (popup != null) { popup.SetActive(true); } }
public PopTextWidget(PopType type) { _life = start_life = random.Next(1, 3); _velocity = new Vector2((float)((random.NextDouble() * 5) - 2.5f), -5); Position = new Vector2(1024 / 2, 768 / 2); _type = type; }
public uint FindPopulationAmountByType(PopType ipopType) { uint result = 0; foreach (Province pro in ownedProvinces) { result += pro.FindPopulationAmountByType(ipopType); } return(result); }
public NodeEditor(HashSet <string> _curKey, PopType type) { Type = type; if (type == PopType.NewPrefab) { InitializeComponent(); comboBox_Type.SelectedIndex = 5; curKey = _curKey; } }
public PopOrderGetFunction GetOrderGetFunction(PopType popType) { var first = this.pops.FirstOrDefault(obj => obj.Accept(popType)); if (first == null) { throw new Exception("未找到支持的平台:" + popType); } return(first.OrderGetFunctionType); }
PopBase GetPop(PopType popType) { var first = this.pops.FirstOrDefault(obj => obj.Accept(popType)); if (first == null) { throw new Exception("未找到支持的平台:" + popType); } return(first); }
/// <summary> /// 更新缓存并保存到文件 /// </summary> /// <param name="xDoc"></param> public static void UpdateAndSaveAreas(XDocument xDoc, PopType popType) { if (popType == PopType.TMALL) { popType = PopType.TAOBAO; } using (FileStream fs = new FileStream(System.IO.Path.Combine(EnvironmentDirHelper.DIR_DATA, popType + "_Address.xml"), FileMode.Create)) { xDoc.Save(fs); } LoadFile(popType); }
public void ShowPop(PopType pType) { if (this.isPopShow || !this.dicPop.ContainsKey(pType)) { return; } this.isPopShow = true; this.objPopPrevent.SetActive(true); this.nowPop = this.dicPop[pType]; this.nowPop.gameObject.SetActive(true); }
public List <PopUnit> FindAllPopUnits(PopType ipopType) { List <PopUnit> result = new List <PopUnit>(); foreach (PopUnit pop in allPopUnits) { if (pop.type == ipopType) { result.Add(pop); } } return(result); }
private void AddPop(PopType type, int quantity, string culture, string religion) { var key = GetKey(type, culture, religion); if (pops.ContainsKey(key)) { pops[key].Add(quantity); } else { pops.Add(key, new Pop(type, quantity, culture, religion)); } }
public override bool canThisPromoteInto(PopType targetType) { if (targetType == PopType.Farmers && Country.Invented(Invention.Farming) || targetType == PopType.Artisans ) { return(true); } else { return(false); } }
public uint FindPopulationAmountByType(PopType ipopType) { List <PopUnit> list = FindAllPopUnits(ipopType); uint result = 0; foreach (PopUnit pop in list) { if (pop.type == ipopType) { result += pop.population; } } return(result); }
private PddReqWaybillGetSenderAddress ConvertToAddress(string senderAddress, PopType sourceType) { string[] ss = AddressService.Parse5Address(senderAddress, sourceType, PopType.PINGDUODUO); PddReqWaybillGetSenderAddress address = new PddReqWaybillGetSenderAddress { province = ss[0], city = ss[1], district = ss[2], town = ss[3], detail = ss[4], }; return(address); }
public static void StartPopProgram(PopType popType, string popTalkId, string popBuyerId, string popOrderId) { if (popType == PopType.TAOBAO || popType == PopType.TMALL) { StartTaobaoProgram(popTalkId, popBuyerId, popOrderId); } else if (popType == PopType.PINGDUODUO) { StartPddPropgram(popTalkId, popBuyerId, popOrderId); } else { throw new Exception("暂时不支持的聊天平台"); } }
public static string PopToken(this string input, PopType popType, out string output) { var chars = new[] { popType == PopType.Space ? ' ' : popType == PopType.Comma ? ',' : popType == PopType.Newline ? '\n' : '`' }; var tokens = input.Split(chars, 2); output = tokens[1].TrimStart(); return(tokens[0].Trim()); }
public static string GetMapPropertyNameByKey(PopType popType, string goodsType, string key) { var map = maps.FirstOrDefault(obj => obj.MapTo == (int)popType && goodsType == obj.GoodsType); if (map == null) { throw new Exception("未能找到对应的映射关系:" + popType + "," + goodsType + "," + key); } foreach (var pair in map.Content) { if (pair.Key.Trim().Equals(key.Trim(), StringComparison.OrdinalIgnoreCase)) { return(pair.Value); } } return(""); }
private double CityMod(PopType popType) { double mod = 1; if (type == CityTypes.forest && popType == PopType.woodcutter) { mod *= 1.5; } if (type == CityTypes.plain && popType == PopType.farmer) { mod *= 1.5; } if (type == CityTypes.mountains && popType == PopType.crafter) { mod *= 1.5; } return(mod); }
private double CalculateSurplus(PopType popType) { double surplus = 0; ResourceType res = population[(int)popType].producingResource; if (res != ResourceType.none) { surplus = population[(int)popType].productionAmount * market.PriceInCoins(res); } else { if (popType == PopType.trader) { surplus = TradeStoreWorth(); } } return(surplus); }
private void Show(string content, string title, PopType popType, MessageType messageType, bool isModal) { Grid grid = new Grid(); grid.Width = 380d; grid.VerticalAlignment = VerticalAlignment.Top; ColumnDefinition col1 = new ColumnDefinition(); ColumnDefinition col2 = new ColumnDefinition(); grid.ColumnDefinitions.Add(col1); grid.ColumnDefinitions.Add(col2); col1.Width = GridLength.Auto; TextBlock txtContent = new TextBlock(); txtContent.TextWrapping = TextWrapping.Wrap; txtContent.TextAlignment = TextAlignment.Left; txtContent.Text = content; txtContent.FontSize = 12D; txtContent.Margin = new Thickness(12, 0, 0, 0); txtContent.VerticalAlignment = VerticalAlignment.Center; txtContent.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; txtContent.FontFamily = new FontFamily("Tahoma,SimSun,PMingLiU"); txtContent.SetValue(Grid.ColumnProperty, 1); grid.Tag = content; Content = grid; Title = title; PopType = popType; MessageType = messageType; ImageIcon = new Image(); ImageIcon.Stretch = Stretch.None; ImageIcon.Margin = new Thickness(0, 1, 0, 0); ImageIcon.VerticalAlignment = VerticalAlignment.Top; ImageIcon.SetValue(Grid.ColumnProperty, 0); grid.Children.Add(txtContent); grid.Children.Add(ImageIcon); Show(isModal); }
public NodeEditor(PopType type) { Type = type; if (type == PopType.EditNode) { InitializeComponent(); comboBox_Type.SelectedIndex = 5; label_Title.Text = "워크플로우 편집기"; button_Cancle.Enabled = false; button_Cancle.Visible = false; button_AddPrefeb.Text = "적용"; button_AddPrefeb.Location = button_Cancle.Location; } else if (type == PopType.NewNode) { InitializeComponent(); comboBox_Type.SelectedIndex = 5; label_Title.Text = "새 워크플로우 추가"; } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(null); } PopType pt = (PopType)value; if (pt == PopType.TAOBAO || pt == PopType.TMALL || pt == PopType.ALIBABA) { return(IMAGE_TB); } if (pt == PopType.PINGDUODUO) { return(IMAGE_PDD); } return(null); }
/// <summary> /// 读取文件到缓存 /// </summary> private static void LoadFile(PopType popType) { if (popType == PopType.TMALL) { popType = PopType.TAOBAO; } lock (Address) { var root = new AddressNode { Type = "Country", Name = "中国", ShortName = "中国" }; XDocument xDoc = XDocument.Load(System.IO.Path.Combine(EnvironmentDirHelper.DIR_DATA, popType + "_Address.xml")); foreach (var province in xDoc.Root.Elements()) { //省 AddressNode p = new AddressNode { Name = province.Attribute("Name").Value, ShortName = province.Attribute("ShortName").Value, Type = province.Name.LocalName }; root.SubNodes.Add(p); //市或者省直辖行政区 foreach (var city in province.Elements()) { AddressNode c = new AddressNode { Name = city.Attribute("Name").Value, ShortName = city.Attribute("ShortName").Value, Type = city.Name.LocalName }; p.SubNodes.Add(c); //区县,二级市 foreach (var district in city.Elements()) { c.SubNodes.Add(new AddressNode { Name = district.Attribute("Name").Value, ShortName = district.Attribute("ShortName").Value, Type = district.Name.LocalName }); } } } Address[popType] = root; } }
public Value getMiddleNeedFullfilling(PopType type) { Value result = new Value(0); uint allPopulation = 0; List <PopUnit> localPops = FindAllPopUnits(type); if (localPops.Count > 0) { foreach (PopUnit pop in localPops) // get middle needs fullfiling according to pop weight { allPopulation += pop.population; result.add(pop.NeedsFullfilled.multiple(pop.population)); } return(result.divide(allPopulation));; } else/// add defualt population { //PopUnit.tempPopList.Add(new PopUnit(Province.defaultPopulationSpawn, type, this.owner.culture, this)); PopUnit.tempPopList.Add(PopUnit.Instantiate(Province.defaultPopulationSpawn, type, this.owner.culture, this)); //return new Value(float.MaxValue);// meaning always convert in type if does not exist yet return(new Value(0)); } }
private string GetKey(PopType type, string culture, string religion) { return($"{type}/{culture}/{religion}"); }
public void IncreaseJob(PopType popType, float relativeAmount) { var pops = SplitPops((int)(Pops.Sum(p => p.Size) * relativeAmount), Pops, c => c, r => r); pops.ForEach(AddPop); }
/// <summary>TODO::Description.</summary> public PopOperation(PopType popType) : base("$pop",(int) popType) { }
protected GrainGetter(PopUnit source, int sizeOfNewPop, PopType newPopType, Province where, Culture culture, IWayOfLifeChange oldLife) : base(source, sizeOfNewPop, newPopType, where, culture, oldLife) { changeProductionType(Product.Grain); //sentToMarket = new Storage(Product.Grain); }