public ModelUnit CreateModel(string modelName, Vector3 pos = default(Vector3), float scaleFactor = 1, bool setPos = false) { string modelPath = null; GameObject modelObj = null; ModelUnit unit = null; if (modelName.EndsWith("Ui")) { modelName = modelName.Substring(0, modelName.Length - 2); } modelPathDic.TryGetValue(modelName, out modelPath); if (!string.IsNullOrEmpty(modelPath)) { modelObj = ResourcesMgr.GetInstance().LoadAsset(modelPath, false); modelObj.transform.SetParent(modelRoot); } if (modelObj != null) { modelObjDic.TryGetValue(modelObj.GetInstanceID(), out unit); if (unit == null) { unit = new ModelUnit(); unit.isUiModel = false; unit.SetModelObj(modelObj, modelName); unit.SetSelfPosSize(pos, scaleFactor, setPos); modelObjDic.Add(modelObj.GetInstanceID(), unit); } } return(unit); }
//向对象池里面存对象 public void putBack(ModelUnit unit) { //将传进来的对象隐藏(处于非激活状态) unit.SelfGameObj.SetActive(false); //添加到对象池中(添加到集合中) poolDic.Add(unit.name, unit); }
private void OnRecieveUnitInfo(params object[] args) { unit = args[0] as ModelUnit; if (unit != null) { curModelName = unit.name; if (titleText) { titleText.text = args[1].ToString(); } } }
void Awake() { //窗体性质 CurrentUIType.UIForms_Type = UIFormType.PopUp; //弹出窗体 CurrentUIType.UIForm_LucencyType = UIFormLucenyType.Translucence; CurrentUIType.UIForms_ShowMode = UIFormShowMode.ReverseChange; //注册按钮事件:退出 RigisterButtonObjectEvent("Btn_Close", P => { CloseUIForm(); } ); content = UnityHelper.FindTheChildNode(gameObject, "content"); foreach (Transform child in content.GetComponentsInChildren <Transform>()) { var cfg = GetModelName(child.name); if (cfg != null) { RigisterButtonObjectEvent(child.name, P => { Vector3 pos = new Vector3(cfg.posX, cfg.posY, cfg.posZ); curUnit = ObjectPool.Instance.takeOne(cfg.modelName, false, pos, 0.2f, true); CloseUIForm(); CloseUIForm(ProConst.HERO_INFO_UIFORM); OpenUIForm(ProConst.OPERATEMODELFORM); DispatchEvent("ApartUnit", curUnit, cfg.title); } ); } } }
public ModelUnit takeOne(string name, bool isUiObj = false, Vector3 pos = default(Vector3), float scaleFactor = 0.5f, bool setPos = false) { if (isUiObj && !name.EndsWith("Ui")) { name += "Ui"; } ModelUnit unit = null; if (poolDic.Count == 0) { unit = NoUnitHandle(name, isUiObj, pos, scaleFactor, setPos); return(unit); } poolDic.TryGetValue(name, out unit); if (unit != null) { unit.SelfGameObj.SetActive(true); poolDic.Remove(name); return(unit); } unit = NoUnitHandle(name, isUiObj, pos, scaleFactor, setPos); return(unit); }
public ReceiverModelUnit(ModelUnit modelUnit) { ModelUnit = modelUnit; }
public void SetUnit(ModelUnit unit) { this.unit = unit; this.modelName = unit.name; }
public static ModelUnit SetProperties(ModelUnit @this, IBasicProperties properties) { @this.Properties = properties; return(@this); }
public PublisherModelUnit(ModelUnit modelUnit) { ModelUnit = modelUnit; }
public static PublisherModelUnit GetPublisher(this ModelUnit @this) { @this.Model.ExchangeDeclare(@this.ExchangeName, @this.Type); return(new PublisherModelUnit(@this)); }
public static ReceiverModelUnit GetReceiver(this ModelUnit @this) { @this.Model.ExchangeDeclare(@this.ExchangeName, @this.Type); return(new ReceiverModelUnit(@this)); }
public static ModelUnit AsDurable(this ModelUnit @this) { @this.IsDurable = true; return(@this); }
public static ModelUnit AsAutoDelete(this ModelUnit @this) { @this.IsAutoDelete = true; return(@this); }
//private const string URL = "http://*****:*****@myirent.com"; HttpClient client = new HttpClient(); client.BaseAddress = new Uri(URL); var myContent = JsonConvert.SerializeObject(propertyData); var buffer = System.Text.Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var result = client.PostAsync("", byteContent).Result; var contents = result.Content.ReadAsStringAsync().Result; success = true; } } catch (Exception any) { Console.Write(any.ToString()); MailMessage mailMessage = new MailMessage(); mailMessage.To.Add("*****@*****.**"); mailMessage.From = new MailAddress("*****@*****.**"); mailMessage.Subject = "CoStar XML Feed - Error"; mailMessage.Body = any.ToString(); SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.myirent.com"; //Or Your SMTP Server Address smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential ("*****@*****.**", "iRent4Now!"); smtp.Send(mailMessage); success = false; } }