Exemplo n.º 1
0
 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";
 }
Exemplo n.º 2
0
        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";
            }
        }
Exemplo n.º 3
0
 public void SpawnEnemy(EType type, int amount)
 {
     for (int i = 0; i < amount; i++)
     {
         Spawn("Enemy", type.ToString());
     }
 }
Exemplo n.º 4
0
        /// <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);
            }
        }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        AudioManager.Instance.PlaySound(type.ToString());
        rb = GetComponent <Rigidbody>();

        rb.AddForce(direction * force, ForceMode.Impulse);
    }
Exemplo n.º 6
0
        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("");
        }
Exemplo n.º 7
0
        /// <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);
            }
        }
Exemplo n.º 8
0
        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;
                }
            }
        }
Exemplo n.º 9
0
 public override string ToString(bool detailed)
 {
     if (detailed)
     {
         return("ESVariable[" + type + "]");
     }
     else
     {
         return(type.ToString());
     }
 }
Exemplo n.º 10
0
 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);
     }
 }
Exemplo n.º 11
0
    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;
            }
        }
    }
Exemplo n.º 12
0
        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());
                }
            }
        }
Exemplo n.º 14
0
    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());
    }
Exemplo n.º 15
0
    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;
            }
        }
    }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
 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()));
 }
Exemplo n.º 19
0
        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;
        }
Exemplo n.º 20
0
        public List <Book> GetFinishedBooks(EType type)
        {
            string typeString = type.ToString();

            return(this.GetFinishedBooksBase().Where(l => l.TypeString == typeString).ToList());
        }
Exemplo n.º 21
0
 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;
        }