Example #1
0
        /// <summary>
        ///  获取所有的动作信息(out 控制器信息)
        /// </summary>
        /// <param name="controllers">控制器信息</param>
        /// <returns></returns>
        public static IList <MVCAction> GetAllActionByAssembly(out IList <MVCController> controllers)
        {
            controllers = new List <MVCController>();

            var result = new List <MVCAction>();

            var types = Assembly.Load("ShengUI.Logic.Admin").GetTypes();

            foreach (var type in types)
            {
                if (type.BaseType.Name == "Controller")//如果是Controller
                {
                    var controller = new MVCController();
                    controller.ControllerName = type.Name.Replace("Controller", "");//去除Controller的后缀
                    //设置Controller数组
                    object[] attrs = type.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), true);
                    if (attrs.Length > 0)
                    {
                        controller.Description = (attrs[0] as System.ComponentModel.DescriptionAttribute).Description;
                    }
                    string defaultPage = "";//默认首页的控制器
                    result.AddRange(GetActions(type, out defaultPage));
                    controller.LinkUrl = "/Admin/" + controller.ControllerName + "/" + defaultPage;
                    controllers.Add(controller);
                }
            }
            return(result);
        }
Example #2
0
        public static SelectListItem ToEntity(MVCController controller)
        {
            SelectListItem item = new SelectListItem();

            item.Value = controller.ControllerName;
            item.Text  = controller.ControllerName;
            return(item);
        }
Example #3
0
 private void btnAddToParent_Click(object sender, System.EventArgs e)
 {
     if (ParentMVCController != null && ParentMVCController.List_ChildrenControllers != null &&
         ParentMVCController.List_ChildrenControllers.Count > 0)
     {
         MVCController <TEntity> controller =
             (MVCController <TEntity>)ParentMVCController.GetActiveController(ViewerName.InPatientRoomViewer);
         if (controller == null)
         {
             return;
         }
         controller.AddToParent();
     }
 }
Example #4
0
 private void Awake()
 {
     if (_instance == null)
     {
         //if not, set instance to this
         _instance = this;
     }
     //If instance already exists and it's not this:
     else if (_instance != this)
     {
         //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
         Destroy(gameObject);
         return;
     }
 }
 private void btnSaveAndNew_Click(object sender, System.EventArgs e)
 {
     if (BaseControllerObject.SaveChanges(CommonTransactionType))
     {
         XtraMessageBox.Show("تـــم الحفـــظ بنجـــاح", "تنبيـــه", MessageBoxButtons.OK, MessageBoxIcon.Information,
                             MessageBoxDefaultButton.Button1, DefaultBoolean.Default);
         MVCController.BeforeCreatingNew();
         MVCController.CreateNew();
         MVCController.AfterCreateNew();
     }
     else
     {
         XtraMessageBox.Show(BaseControllerObject.MessageToView, "خطــــأ", MessageBoxButtons.OK, MessageBoxIcon.Error,
                             MessageBoxDefaultButton.Button1, DefaultBoolean.Default);
     }
 }
Example #6
0
        /// <summary>
        /// 获取所有的控制器信息
        /// </summary>
        /// <returns></returns>
        public static IList <MVCController> GetAllControllerByAssembly()
        {
            var result = new List <MVCController>();
            var types  = Assembly.Load("ShengUI.Logic.Admin").GetTypes();

            foreach (var type in types)
            {
                if (type.BaseType.Name == "Controller")//如果是Controller
                {
                    var controller = new MVCController();
                    controller.ControllerName = type.Name.Replace("Controller", "");//去除Controller的后缀

                    object[] attrs = type.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), true);
                    if (attrs.Length > 0)
                    {
                        controller.Description = (attrs[0] as System.ComponentModel.DescriptionAttribute).Description;
                    }

                    controller.LinkUrl = "/Admin/" + controller.ControllerName + "/Index";
                    result.Add(controller);
                }
            }
            return(result);
        }
Example #7
0
    // Start is called before the first frame update
    void Start()
    {
        _sr            = this.transform.GetComponent <SpriteRenderer>();
        _sStatedefault = Resources.Load <Sprite>("Buildings/DirtMound/dirt_mound_final");


        //SetUp the NotifyObj
        _srNotify = _NotificationObject.transform.GetComponent <SpriteRenderer>();

        _sNotification   = Resources.Load <Sprite>("UI/Exclamation_Icon");
        _srNotify.sprite = _sNotification;

        _animator = GetComponentInChildren <Animator>();

        if (eType == BuildingType.Vacant)
        {
            eState     = BuildingState.Available;
            _sr.sprite = _sStatedefault;

            //Possible error here in assigning something to be a dirtmound
            if (eType == BuildingType.Vacant)
            {
                setTeam(500); // default value for destroyed state
            }
        }


        //Other classes
        GameObject o = GameObject.FindGameObjectWithTag("BuildMenu");

        _BuildMenu        = o.GetComponent <UIBuildMenu>();
        o                 = GameObject.FindGameObjectWithTag("DestroyMenu");
        _DestroyMenu      = o.GetComponent <UIBuildMenu>();
        o                 = GameObject.FindGameObjectWithTag("BuildingCapWarning");
        _BuildingCapMenu  = o.GetComponent <UIBuildMenu>();
        _cameraController = Camera.main.GetComponent <CameraController>();


        //little unnecessary
        _controller = MVCController.Instance;

        //Health Bar Prefab
        if (_HealthBarObj == null)
        {
            _HealthBarObj = Resources.Load <GameObject>("UI/HealthBarCanvas");
        }
        SetUpHealthBar(_HealthBarObj.gameObject);

        //Construction Bar Prefab
        if (_ConstructionBarObj == null)
        {
            _ConstructionBarObj = Resources.Load <GameObject>("UI/ConstructionBarCanvas");
        }
        SetUpConstructionBar(_ConstructionBarObj);

        UpdateState();
        setUpWorkers();
        UpdateHealthBar();

        //Feel like these could load in a different order on start
        _ID = GameManager.Instance.getBuildingIndex();
        // Debug.Log(this.gameObject + " ID is: " + _ID);

        setUpInstantConstruction();

        //If were not in the player zone hide the employees
        if (GameManager.Instance.CheckInPlayerZone(this.transform.position.x) == false)
        {
            StartCoroutine(hideWorkers());
        }
    }