public Monster(EType type) { this.type = type; head = "images/" + type.ToString() + "_0.png"; body = "images/" + type.ToString() + "_1.png"; leg = "images/" + type.ToString() + "_2.png"; }
private void cmdType_SelectedIndexChanged(object sender, EventArgs e) { if (!Enum.IsDefined(typeof(EType), cmdType.Text)) { labStatus.Text = "找不到【" + cmdType.Text + "】类型"; labStatus.ForeColor = Color.Red; return; } EType ddType = (EType)Enum.Parse(typeof(EType), cmdType.Text); string str = ddType.ToString(); int maxCH = System.Convert.ToInt16(str.Substring(str.Length - 2, 2)); SetCH(maxCH); if (ddType == EType.EL_40_08) { txtBaud.Text = "38400,N,8,1"; } else { txtBaud.Text = "57600,N,8,1"; } }
public void SpawnEnemy(EType type, int amount) { for (int i = 0; i < amount; i++) { Spawn("Enemy", type.ToString()); } }
/// <summary> /// 打开串口 /// </summary> /// <param name="comName"></param> /// <param name="er"></param> /// <returns></returns> public bool Open(string comName, out string er, string setting = "9600,n,8,1") { er = string.Empty; try { if (_devMon == null) { er = _devType.ToString() + "未找到程序集,请检查"; return(false); } if (!_devMon.Open(comName, out er, setting)) { return(false); } _conStatus = true; return(true); } catch (Exception ex) { er = ex.ToString(); return(false); } }
// Use this for initialization void Start() { AudioManager.Instance.PlaySound(type.ToString()); rb = GetComponent <Rigidbody>(); rb.AddForce(direction * force, ForceMode.Impulse); }
public string ToOpenSSLConfig() { if (EType == ElementType.SEQUENCE) { string sectionname = SectionManager.CreateSectionSequence(); SectionName = sectionname; ExtensionCoder.DefineSection(sectionname); if (ParentSection != null) { ExtensionCoder.AddFieldInSection(ParentSection.SectionName, Name + "=SEQUENCE:" + sectionname); } // Childrens foreach (ASNElement el in Childs) { el.ToOpenSSLConfig(); } if (ParentSection == null) { return(Name + "=" + EType.ToString() + ":" + sectionname); } } else if (ParentSection != null) { ExtensionCoder.AddFieldInSection(ParentSection.SectionName, Name + "=" + EType.ToString() + ":" + Value); } else { return(Name + "=" + EType.ToString() + ":" + Value); } return(""); }
/// <summary> /// 打开串口 /// </summary> /// <param name="comName"></param> /// <param name="er"></param> /// <returns></returns> public bool Open(string comName, out string er, string setting = "115200,n,8,1") { er = string.Empty; try { if (_devIO == null) { er = _ioType.ToString() + CLanguage.Lan("未找到程序集,请检查"); return(false); } if (!_devIO.Open(comName, out er, setting)) { return(false); } _conStatus = true; return(true); } catch (Exception ex) { er = ex.ToString(); return(false); } }
public CMeterCom(EType devType, int idNo = 0, string name = "IMeter") { this._idNo = idNo; this._name = name; this._devType = devType; //反射获取PLC类型 string plcModule = "C" + devType.ToString(); Assembly asb = Assembly.GetAssembly(typeof(IMeter)); Type[] types = asb.GetTypes(); object[] parameters = new object[2]; parameters[0] = _idNo; parameters[1] = _name; foreach (Type t in types) { if (t.Name == plcModule && t.GetInterface("IMeter") != null) { _devMon = (IMeter)asb.CreateInstance(t.FullName, true, System.Reflection.BindingFlags.Default, null, parameters, null, null); break; } } }
public override string ToString(bool detailed) { if (detailed) { return("ESVariable[" + type + "]"); } else { return(type.ToString()); } }
private void SetButtonListener(GUI_TabButton buttonInstance, EType type) { buttonInstance.SetButtonName(type.ToString()); if (type == EType.Game) { buttonInstance.GetButton().onClick.AddListener(CreateGame); } else if (type == EType.PL1Structure) { buttonInstance.GetButton().onClick.AddListener(CreateModelRepresentation); } }
public void Awake() { iLength = System.Enum.GetNames(typeof(IType)).Length; _eType = (IType)Random.Range(0, iLength); sr = GetComponent <SpriteRenderer>(); sprites = Resources.LoadAll <Sprite>("_Sprites/Ingredients"); foreach (Sprite s in sprites) { if (s.name == EType.ToString()) { sr.sprite = s; } } }
public static string GetTemplateString(this EType e) { string metaInfo = "SupplyOfProducts.Api.Controllers.ViewModels."; metaInfo += e.ToString(); var aux = Activator.CreateInstance("SOP.Api.Common", metaInfo); JsonSerializerSettings s = new JsonSerializerSettings(); s.NullValueHandling = NullValueHandling.Include; s.ReferenceLoopHandling = ReferenceLoopHandling.Serialize; s.MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead; return(JsonConvert.SerializeObject(aux.Unwrap(), Formatting.Indented, s)); }
/// <summary> /// Show. /// </summary> public void Show(string content, EType type = EType.ShortFlyFromBot) { if (mGameObject != null) { if (mCanvasGroup == null) { mCanvasGroup = mGameObject.GetComponent <CanvasGroup>(); if (mCanvasGroup == null) { Debug.LogError("[" + typeof(MyUGUIFlyingMessage).Name + "] Show(): Could not find Canvas Group component."); return; } } if (mText == null) { mText = MyUtilities.FindObjectInAllLayers(mGameObject, "Text").GetComponent <Text>(); } #if USE_MY_UI_TMPRO if (mTextTMPro == null) { mTextTMPro = MyUtilities.FindObjectInAllLayers(mGameObject, "Text").GetComponent <TextMeshProUGUI>(); } #endif mGameObject.SetActive(true); if (mText != null) { mText.text = content; } #if USE_MY_UI_TMPRO if (mTextTMPro != null) { mTextTMPro.text = content; } #endif if (mAnimator == null) { mAnimator = mGameObject.GetComponent <Animator>(); } if (mAnimator != null) { mAnimator.Play(type.ToString()); } } }
public static string GetKeyName(EType _type) { AttributeCache attribute = Utility.EnumUtility.GetAttribute <AttributeCache>(_type); string str = ""; if (attribute.EachUsername) { str += GameManager.Instance.mInfo.username + "_"; } if (attribute.EachGame) { str += GameManager.GAME.ToString() + "_"; } return(str += _type.ToString()); }
public void Randomize() { _eType = (IType)Random.Range(0, iLength); if (EType == IType.Energy) { Randomize(); } sprites = Resources.LoadAll <Sprite> ("_Sprites/Ingredients"); foreach (Sprite s in sprites) { if (s.name == EType.ToString()) { m_Image.sprite = s; } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string result = ""; if (value is EType) { EType type = (EType)value; if (TypeConverter.typeItemSource.ContainsKey(type)) { result = TypeConverter.typeItemSource[type]; } else { result = type.ToString(); } } return(result); }
static string getMessage(EType type, string message) { return((type == EType.Other) ? message : type.ToString() + "=>" + message); }
/// <summary> /// Return name of game object by type. /// </summary> public static string GetGameObjectName(EType type) { return(PREFAB_NAME + (type == EType.Default ? string.Empty : "_" + type.ToString())); }
SetType( EType type) { if (this.Type != EType.NA) { throw new Bam.Core.Exception("Project configuration already has type {0}. Cannot change it to {1}", this.Type.ToString(), type.ToString()); } this.Type = type; }
public List <Book> GetFinishedBooks(EType type) { string typeString = type.ToString(); return(this.GetFinishedBooksBase().Where(l => l.TypeString == typeString).ToList()); }
public override string ToString() { return(type.ToString().ToLower()); }
SetType( EType type) { if (this.Type != EType.NA) { if (this.Type == type) { return; } throw new Bam.Core.Exception("Project configuration already has type {0}. Cannot change it to {1}", this.Type.ToString(), type.ToString()); } this.Type = type; }