예제 #1
0
        public override List <SystemItem> AvailableItems <T>(ItemIdentifier itemId)
        {
            //if looking for children, return nothing
            if (itemId != null)
            {
                return(new List <SystemItem>());
            }


            List <SystemItem> allItems = new List <SystemItem>();
            var session = NHibernateProvider.GetCurrentSession();

            foreach (var c in session.Linq <CompanyProxy>())
            {
                SystemItem si = new SystemItem();
                si.Description = "Company with the name: " + c.Name;
                si.Name        = c.Name;
                si.ItemId      = new ItemIdentifier(c.Symbol, Constants.companyProviderID);
                si.Icon        = "package2.png";
                si.HasChildren = false;
                allItems.Add(si);
            }

            return(allItems);
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Quantity,CostPice,SalePrice,MainImage,ItemCode,Status,ItemCategory,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy")] SystemItem systemItem)
        {
            if (id != systemItem.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(systemItem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SystemItemExists(systemItem.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemItem));
        }
예제 #3
0
        public static SystemItem Update(SystemItem param)
        {
            var dbContext = new DbContext();

            dbContext.SystemConfigDb.Update(param);
            mData[param.ConfigKey] = param;
            return(param);
        }
예제 #4
0
        public async Task <IActionResult> Create([Bind("Id,Name,Description,Quantity,CostPice,SalePrice,MainImage,ItemCode,Status,ItemCategory,CreatedDate,CreatedBy,ModifiedDate,ModifiedBy")] SystemItem systemItem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(systemItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(systemItem));
        }
예제 #5
0
        public static (bool, SystemItem) GetByName(string key)
        {
            SystemItem result  = null;
            bool       isExist = false;

            if (mData.ContainsKey(key))
            {
                result  = mData[key];
                isExist = true;
            }
            return(isExist, result);
        }
예제 #6
0
 private void RemoveItem(SystemItem item)
 {
     if (FileList?.Items == null)
     {
         return;
     }
     FileList.Items.Remove(item);
     if (FileList.Items.Count == 0)
     {
         FileList = null;
     }
 }
        // Email profiles
        private void BuildEmailProfiles()
        {
            var emailProfiles = EmailProfile.Find(x => !x.Deleted).ToList();

            foreach (var profile in emailProfiles)
            {
                var id   = profile.SitecoreId();
                var item = new SystemItem(id, profile.Name);
                item.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/mails.png");
                _emailProfiles.AddItem(item);
            }
            _emailProfiles.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/mail-open-table.png");
            _emailProfiles.SetRevision(Guid.NewGuid());
        }
        // Member types
        private void BuildMemberTypes()
        {
            var memberTypes = _memberService.GetMemberTypes();

            foreach (var memberType in memberTypes)
            {
                var id   = memberType.SitecoreId();
                var item = new SystemItem(id, memberType.Name);
                item.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/user1.png");
                _memberTypes.AddItem(item);
            }

            _memberTypes.SetRevision(Guid.NewGuid());
        }
        // Order number series.
        private void BuildOrderNumberSeries()
        {
            var orderNumberSeries = OrderNumberSerie.Find(x => !x.Deleted).ToList();

            foreach (var serie in orderNumberSeries)
            {
                var id   = serie.SitecoreId();
                var item = new SystemItem(id, serie.OrderNumberName);
                item.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/counter.png");
                _orderNumberSeries.AddItem(item);
            }
            _orderNumberSeries.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/counter-count-up.png");
            _orderNumberSeries.SetRevision(Guid.NewGuid());
        }
예제 #10
0
        private void OnSystemItemSelectedEventHandler(SystemItem item)
        {
            _fileManager.OnSystemItemSelectedEvent -= OnSystemItemSelectedEventHandler;

            if (InternalTools.IsValidImageFile(item.path))
            {
                _selectedImageText.text = item.name;
                _selectedImageData      = ImageConvert.Convert(ImageConvert.GetTextureFromPath(item.path));
            }
            else
            {
                _selectedImageText.text = "File isn't valid.";
            }
        }
        public void ShowInfo(SystemItem item, uint color, int coordinateX, int coordinateY)
        {
            if (item is FolderItem folder)
            {
                _graphics.DrawString(folder.Name, Settings.FontName, color, coordinateX, coordinateY, Settings.FontSize);
                _graphics.DrawString("<dir>", Settings.FontName, color, coordinateX + Settings.ExtensionCoodrinateX, coordinateY, Settings.FontSize);
            }

            if (item is FileItem file)
            {
                _graphics.DrawString(file.Name, Settings.FontName, color, coordinateX, coordinateY, Settings.FontSize);
                _graphics.DrawString($"<{file.Extension}>", Settings.FontName, color, coordinateX + Settings.ExtensionCoodrinateX, coordinateY, Settings.FontSize);
                _graphics.DrawString(file.Size.ToViewableSize(), Settings.FontName, color, coordinateX + Settings.SizeCoodrinateX, coordinateY, Settings.FontSize);
            }
        }
예제 #12
0
 public static void InsertSystemItem(SystemItem systemItem)
 {
     try
     {
         using (var db = new SMSContext())
         {
             db.SystemItems.Add(systemItem);
             db.SaveChanges();
         }
     }
     catch (Exception exception)
     {
         LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message);
     }
 }
        // Price groups
        private void BuildPriceGroupItems()
        {
            var priceGroups = PriceGroup.Find(x => !x.Deleted).ToList();

            foreach (var pg in priceGroups)
            {
                var id   = pg.SitecoreId();
                var item = new SystemItem(id, GetPriceGroupName(pg));
                item.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/money-coin.png");

                _priceGroups.AddItem(item);
            }
            _priceGroups.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/money.png");
            _priceGroups.SetRevision(Guid.NewGuid());
        }
        // Currency
        private void BuildCurrencyItems()
        {
            var currencies = Currency.Find(x => !x.Deleted).ToList();

            foreach (var currency in currencies)
            {
                var id   = currency.SitecoreId();
                var item = new SystemItem(id, currency.Name);
                item.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/money--arrow.png");


                _currencies.AddItem(item);
            }
            _currencies.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/currency-euro.png");
            _currencies.SetRevision(Guid.NewGuid());
        }
예제 #15
0
        public static SystemItem Insert(SystemItem param)
        {
            var(isExist, result) = GetByName(param.ConfigKey);

            if (isExist)
            {
                Update(param);
            }
            else
            {
                var dbContext = new DbContext();
                dbContext.SystemConfigDb.InsertReturnIdentity(param);
            }
            mData[param.ConfigKey] = param;
            return(param);
        }
        public override SystemItem FindSystemItem(string id)
        {
            Umbraco.Forms.Data.Storage.FormStorage fs = new Umbraco.Forms.Data.Storage.FormStorage();
            var form = fs.GetForm(Guid.Parse(id));

            if (form != null)
            {
                SystemItem sys = new SystemItem();
                sys.HasChildren = false;
                sys.Icon        = "icon_form.gif";
                sys.ItemId      = new ItemIdentifier(id, this.Id);
                sys.Name        = form.Name;
                return(sys);
            }

            return(null);
        }
예제 #17
0
 public static void UpdateSystemItem(SystemItem systemItem)
 {
     try
     {
         using (var db = new SMSContext())
         {
             var tempSystemItem = db.SystemItems.Single(x => x.Id == systemItem.Id);
             tempSystemItem.SystemItemName = systemItem.SystemItemName;
             tempSystemItem.IsActive       = systemItem.IsActive;
             db.SaveChanges();
         }
     }
     catch (Exception exception)
     {
         LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message);
     }
 }
예제 #18
0
        public static SystemItem GetSystemItemById(int systemId)
        {
            var systemItemObj = new SystemItem();

            try
            {
                using (var db = new SMSContext())
                {
                    systemItemObj = db.SystemItems.Single(x => x.Id == systemId);
                }
            }
            catch (Exception exception)
            {
                //LogManage.Log("MethodName:GetClassById " + Environment.NewLine + " Time: " + DateTime.Now + Environment.NewLine + " ErrorMsg: " + exception.Message);
            }
            return(systemItemObj);
        }
        public override List <SystemItem> AvailableSystemItems()
        {
            List <SystemItem> items = new List <SystemItem>();

            Umbraco.Forms.Data.Storage.FormStorage fs = new Umbraco.Forms.Data.Storage.FormStorage();

            foreach (var f in fs.GetAllForms())
            {
                SystemItem item = new SystemItem();
                item.ItemId      = new ItemIdentifier(f.Id.ToString(), this.Id);
                item.Name        = f.Name;
                item.Description = f.Name;
                item.Icon        = "icon_form.gif";
                item.HasChildren = false;
                items.Add(item);
            }
            return(items);
        }
예제 #20
0
        private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox item = sender as ComboBox;

            if (item != null)
            {
                SystemItem selectItem = item.SelectedItem as SystemItem;

                if (selectItem != null && selectItem.Value != -1)
                {
                    vm.SystemType = (AdvertManage.Model.Enum.SeatManageSubsystem)selectItem.Value;
                    vm.FindSystemMessage();
                }
                else if (item == null)
                {
                    MessageBox.Show("系统类型有误");
                }
            }
        }
예제 #21
0
        /// <summary>
        /// 更新实验状态
        /// type:0未完成,1完成
        /// </summary>
        /// <returns></returns>
        public bool UpdateTestType(string code, string info_DangH, SystemItem systemItem, int type)
        {
            string sql = "update dt_Info  set";

            if (systemItem == SystemItem.Airtight)
            {
                sql += " Airtight=" + type + "";
            }
            else if (systemItem == SystemItem.Watertight)
            {
                sql += " Watertight=" + type + "";
            }
            else if (systemItem == SystemItem.AirPressure)
            {
                sql += " WindPressure=" + type + "";
            }
            sql += " where info_DangH = '" + info_DangH + "' and dt_Code='" + code + "'";
            return(SQLiteHelper.ExecuteNonQuery(sql) > 0 ? true : false);
        }
        public void ShowProperties(SystemItem item)
        {
            bool exit = false;

            while (!exit)
            {
                _graphics.FillRectangle(Settings.ActiveColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY, Settings.PropertiesWidth, Settings.PropertiesHeight);
                _graphics.DrawString("Name:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY, Settings.FontSize);
                _graphics.DrawString(item.Name, Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY, Settings.FontSize);
                _graphics.DrawString("Parent directory:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + Settings.FontSize + 1, Settings.FontSize);
                _graphics.DrawString(item.ParentDirectory, Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY + Settings.FontSize + 1, Settings.FontSize);
                _graphics.DrawString("Root directory:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 2) + 1, Settings.FontSize);
                _graphics.DrawString(item.Root, Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 2) + 1, Settings.FontSize);
                _graphics.DrawString("Last read time:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 3) + 1, Settings.FontSize);
                _graphics.DrawString($"{item.LastAccessTime}", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 3) + 1, Settings.FontSize);
                _graphics.DrawString("Last write time:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 4) + 1, Settings.FontSize);
                _graphics.DrawString($"{item.LastWriteTime}", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 4) + 1, Settings.FontSize);
                _graphics.DrawString("Size:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 5) + 1, Settings.FontSize);
                _graphics.DrawString(item.Size.ToViewableSize(), Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 5) + 1, Settings.FontSize);

                if (item is FileItem file)
                {
                    _graphics.DrawString("Is read only:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 6) + 1, Settings.FontSize);
                    _graphics.DrawString($"{file.IsReadOnly}", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 6) + 1, Settings.FontSize);
                }
                if (item is FolderItem folder)
                {
                    _graphics.DrawString("Files:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 6) + 1, Settings.FontSize);
                    _graphics.DrawString($"{folder.CountFiles}", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 6) + 1, Settings.FontSize);
                    _graphics.DrawString("Folders:", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 7) + 1, Settings.FontSize);
                    _graphics.DrawString($"{folder.CountFolders}", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX + Settings.PropertiesInfoCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 7) + 1, Settings.FontSize);
                }

                _graphics.DrawString("Press Enter to continue :", Settings.FontName, Settings.BlackColor, Settings.PropertiesCoordinateX, Settings.PropertiesCoordinateY + (Settings.FontSize * 9) + 1, Settings.FontSize + 3);
                _graphics.FlipPages();

                if (Console.ReadKey(true).Key == ConsoleKey.Enter)
                {
                    exit = true;
                }
            }
        }
        // Hostnames
        private void BuildHostnames()
        {
            var domains = _domainService.GetDomains();

            var defaultItem = new SystemItem(FieldIds.SystemContent.DefaultHostnameId, "Default");

            defaultItem.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/globe-medium-green.png");

            _hostnames.AddItem(defaultItem);

            foreach (var domain in domains)
            {
                var id   = domain.SitecoreId();
                var item = new SystemItem(id, domain.DomainName);
                item.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/globe-medium-green.png");
                _hostnames.AddItem(item);
            }
            _hostnames.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/globe-green.png");
            _hostnames.SetRevision(Guid.NewGuid());
        }
예제 #24
0
파일: Local.cs 프로젝트: jayvin/Courier
        public SystemItem[] GetChildren(ItemIdentifier itemID)
        {
            SystemItem[] retval = null;

            var provider = Umbraco.Courier.Core.ProviderModel.ItemProviderCollection.Instance.GetProvider(itemID.ProviderId);

            if (string.IsNullOrEmpty(itemID.Id))
            {
                retval = provider.AvailableSystemItems().ToArray();
            }
            else
            {
                retval = provider.AvailableSystemItems(itemID).ToArray();
            }

            if (retval == null)
            {
                retval = new SystemItem[0];
            }

            return(retval);
        }
        private void BuildDataTypeEnums()
        {
            var dataTypes = DataType.Find(x => x.DefinitionName == "Enum" || x.DefinitionName == "EnumMultiSelect").ToList();

            foreach (var dataType in dataTypes)
            {
                var id           = dataType.SitecoreIdForEnum();
                var dataTypeItem = new SystemItem(id, dataType.Name);
                dataTypeItem.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/ui-combo-box.png");
                foreach (var dataTypeEnum in dataType.DataTypeEnums)
                {
                    var dataTypeEnumId   = dataTypeEnum.SitecoreId();
                    var dataTypeEnumItem = new SystemItem(dataTypeEnumId, dataTypeEnum.Name);
                    dataTypeEnumItem.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/ui-button.png");

                    dataTypeItem.AddItem(dataTypeEnumItem);
                }
                dataTypeItem.SetRevision(dataType.Guid.Derived(dataType.ModifiedOn));
                _dataTypeEnums.AddItem(dataTypeItem);
            }
            _dataTypeEnums.AddToFieldList(FieldIDs.Icon, _iconFolder + "/ui/ui-scroll-pane-list.png");
        }
예제 #26
0
    public void SetItemValues()
    {
        #region Planet Items Set

        for (int i = 0; i < Celestials.Count; i++)
        {
            if (Celestials[i].GetComponent <ResourceObject>() == null)
            {
                PlanetItem planetItem = new PlanetItem();

                planetItem.celestialName = Celestials[i].name;
                planetItem.posX          = Celestials[i].transform.position.x;
                planetItem.posY          = Celestials[i].transform.position.y;
                planetItem.posZ          = Celestials[i].transform.position.z;
                planetItem.systemName    = Celestials[i].transform.parent.parent.name;

                itemDB.planets.Add(planetItem);
            }
        }
        #endregion

        #region Asteriod Items Set
        for (int i = 0; i < Celestials.Count; i++)
        {
            if (Celestials[i].GetComponent <ResourceObject>() != null)
            {
                AsteriodItem asteroidItem = new AsteriodItem();

                asteroidItem.celestialName = Celestials[i].name;
                asteroidItem.posX          = Celestials[i].transform.position.x;
                asteroidItem.posY          = Celestials[i].transform.position.y;
                asteroidItem.posZ          = Celestials[i].transform.position.z;
                asteroidItem.systemName    = Celestials[i].transform.parent.parent.name;

                itemDB.asteriods.Add(asteroidItem);
            }
        }
        #endregion

        #region  Systems Items Set
        for (int i = 0; i < SystemPrefabs.Count; i++)
        {
            SystemItem systemItem = new SystemItem();
            systemItem.systemName = SystemPrefabs[i].name;
            for (int j = 0; j < SystemPrefabs[i].transform.Find("Planets").childCount; j++) //Naprendszer bolygóelemek nevei
            {
                systemItem.celestials.Add(SystemPrefabs[i].transform.Find("Planets").GetChild(j).name);
            }

            itemDB.systems.Add(systemItem);
        }
        #endregion

        #region Galaxy Stars Items Set
        for (int i = 0; i < GalaxyStarPrefabs.Count; i++)
        {
            StarItem starItem = new StarItem();

            starItem.starName = GalaxyStarPrefabs[i].name;
            starItem.posX     = GalaxyStarPrefabs[i].transform.position.x;
            starItem.posY     = GalaxyStarPrefabs[i].transform.position.y;
            starItem.posZ     = GalaxyStarPrefabs[i].transform.position.z;

            itemDB.stars.Add(starItem);
        }
        #endregion

        #region Unit Items Set

        for (int i = 0; i < Units.Count; i++)
        {
            UnitItem unit = new UnitItem();

            unit.unitName = Units[i].name;
            unit.posX     = Units[i].transform.position.x;
            unit.posY     = Units[i].transform.position.y;
            unit.posZ     = Units[i].transform.position.z;
            unit.starName = Units[i].transform.parent.parent.name;

            itemDB.units.Add(unit);
        }

        #endregion
    }
예제 #27
0
 private void __ValidateItemWithinSystem(SystemItem system, INavigable item) {
     float systemRadiusSqrd = system.Radius * system.Radius;
     float itemDistanceFromSystemCenterSqrd = Vector3.SqrMagnitude(item.Position - system.Position);
     if (itemDistanceFromSystemCenterSqrd > systemRadiusSqrd) {
         D.Warn("ItemDistanceFromSystemCenterSqrd: {0} > SystemRadiusSqrd: {1}!", itemDistanceFromSystemCenterSqrd, systemRadiusSqrd);
     }
 }
    //private void CheckForOccludedObjectAndProcessOnHoverNotifications() {
    //    GameObject newOccludedObject;
    //    TryCheckForOccludedObject(out newOccludedObject);

    //    // now process any required notifications to said objects
    //    if (newOccludedObject == null) {
    //        // new state is not occluded
    //        if (_currentOccludedObject != null) {
    //            // occluded -> notOccluded transition
    //            _inputHelper.Notify(_currentOccludedObject, "OnHover", false);
    //            ExecuteThisOnHoverContent(true);
    //            _currentOccludedObject = newOccludedObject;   // null
    //        }
    //        // notOccluded -> notOccluded transition: do nothing as System already knows hovered = true
    //    }
    //    else {
    //        // new state is occluded
    //        if (_currentOccludedObject != null) {
    //            // occluded -> occluded transition
    //            //D.Log("CurrentOccludedObject: {0}, NewOccludedObject: {1}.", _currentOccludedObject.name, newOccludedObject.name);
    //            if (newOccludedObject != _currentOccludedObject) {
    //                // occluded -> different occluded transition
    //                _inputHelper.Notify(_currentOccludedObject, "OnHover", false);
    //                _inputHelper.Notify(newOccludedObject, "OnHover", true);
    //                // IMPROVE use UICamera.Notify approach separating the old and new notify in time
    //                _currentOccludedObject = newOccludedObject;
    //            }
    //            // occluded -> same occluded transition: do nothing
    //        }
    //        else {
    //            // notOccluded -> occluded transition
    //            // also handles offSystem -> occluded transition with unneeded ProcessSystemViewOnHover(false)
    //            ExecuteThisOnHoverContent(false);
    //            _inputHelper.Notify(newOccludedObject, "OnHover", true);
    //            _currentOccludedObject = newOccludedObject;
    //        }
    //    }
    //}
    #endregion

    /// <summary>
    /// The OnHover version of CheckForOccludedObject() which also executes any required OnHover notifications.
    /// </summary>
    private void CheckForOccludedObjectAndProcessOnHoverNotifications() {
        GameObject currentObjectToNotify = null;
        GameObject newObjectToNotify = null;

        GameObject newOccludedObject;
        SystemItem newOccludedSystem;
        if (TryCheckForOccludedObject(out newOccludedObject, out newOccludedSystem)) {
            // new state is occluded
            D.AssertNotNull(newOccludedObject);


            if (_currentOccludedObject != null) {
                // occluded -> occluded transition
                if (newOccludedObject != _currentOccludedObject) {
                    // occluded -> different occluded transition
                    D.Log(ShowDebugLog, "Occluded => DifferentOccluded: CurrentOccludedObject = {0}, NewOccludedObject = {1}.", _currentOccludedObject.name, newOccludedObject.name);

                    currentObjectToNotify = _currentOccludedSystem == null ? _currentOccludedObject : _currentOccludedSystem.gameObject;
                    newObjectToNotify = newOccludedSystem == null ? newOccludedObject : newOccludedSystem.gameObject;

                    _inputHelper.Notify(currentObjectToNotify, "OnHover", false);
                    _inputHelper.Notify(newObjectToNotify, "OnHover", true);
                }
                // occluded -> same occluded transition: do nothing
            }
            else {
                // notOccluded -> occluded transition
                // also handles offSystem -> occluded transition with unneeded ExecuteThisOnHoverContent(false)
                D.Log(ShowDebugLog, "NotOccluded => Occluded: NewOccludedObject = {0}.", newOccludedObject.name);

                D.AssertNull(_currentOccludedSystem);

                currentObjectToNotify = System.gameObject;
                newObjectToNotify = newOccludedSystem == null ? newOccludedObject : newOccludedSystem.gameObject;

                _inputHelper.Notify(currentObjectToNotify, "OnHover", false);
                _inputHelper.Notify(newObjectToNotify, "OnHover", true);
            }
        }
        else {
            // new state is not occluded
            D.AssertNull(newOccludedObject);
            D.AssertNull(newOccludedSystem);

            if (_currentOccludedObject != null) {
                // occluded -> notOccluded transition
                D.Log(ShowDebugLog, "Occluded => NotOccluded: CurrentOccludedObject = {0}.", _currentOccludedObject.name);

                currentObjectToNotify = _currentOccludedSystem == null ? _currentOccludedObject : _currentOccludedSystem.gameObject;
                newObjectToNotify = System.gameObject;

                _inputHelper.Notify(currentObjectToNotify, "OnHover", false);
                _inputHelper.Notify(newObjectToNotify, "OnHover", true);
            }
            // notOccluded -> notOccluded transition: do nothing as System already knows hovered = true
        }
        _currentOccludedObject = newOccludedObject; // can be object=null, object=object, null=object or null=null
        _currentOccludedSystem = newOccludedSystem; // can be system=null, system=system, null=system or null=null
    }
    /// <summary>
    /// Assesses the OnHover events received from the Ngui Event System by this OrbitalPlane.
    /// Returns true if the event should be executed by this class, false if not. 
    /// <remarks>If the event should be executed by this class, and there is
    /// currently an occludedObject, the occludedObject will be sent an OnHover(false) event to
    /// allow it to cleanup prior to returning true.</remarks>
    /// </summary>
    /// <param name="isOver">if set to <c>true</c> [is over].</param>
    /// <returns></returns>
    private bool AssessOnHoverEvent(bool isOver) {
        if (_isAlreadyHovering && isOver) {
            // duplicate isOver = true so ignore
            //D.Log(ShowDebugLog, "{0} received duplicate OnHover(true). Ignoring.", DebugName);
            return false;
        }
        _isAlreadyHovering = isOver;

        if (isOver) {
            if (_inputMgr.InputMode != GameInputMode.Normal) {
                D.Error("{0} received OnHover(true) during {1}.{2}.", DebugName, typeof(GameInputMode).Name, _inputMgr.InputMode.GetValueName());
            }
        }

        EnableOnHoverCheckingForOccludedObjects(isOver);
        bool toExecuteNormalOnHover = false;
        if (isOver) {
            if (_currentOccludedObject == null) {
                // just arrived over the orbitalPlane with no occluded object beneath the mouse
                toExecuteNormalOnHover = true;
            }
        }
        else {
            // leaving the orbitalPlane
            toExecuteNormalOnHover = true;
            if (_currentOccludedObject != null) {
                // there is an occludedObject underneath the mouse as we leave the orbitalPlane
                GameObject objectToNotify = _currentOccludedSystem == null ? _currentOccludedObject : _currentOccludedSystem.gameObject;
                _inputHelper.Notify(objectToNotify, "OnHover", false);
                _currentOccludedObject = null;
                _currentOccludedSystem = null;
            }
        }
        return toExecuteNormalOnHover;
    }
    /// <summary>
    /// Checks if this orbitalPlane's collider is occluding another object behind it.
    /// </summary>
    /// <param name="occludedObject">The occluded object that was found or null if no object was found.</param>
    /// <param name="occludedSystem">The occluded system that was found or null if no system was found.</param>
    /// <returns>
    ///   <c>true</c> if an occluded object was found, else <c>false</c>.
    /// </returns>
    private bool TryCheckForOccludedObject(out GameObject occludedObject, out SystemItem occludedSystem) {
        if (_universeDiameter == Constants.ZeroF) { // OPTIMIZE set value in Awake once preset composition DebugSystemCreators no longer in use
            _universeDiameter = GameManager.Instance.GameSettings.UniverseSize.Radius() * 2F;
            D.AssertNotApproxEqual(Constants.ZeroF, _universeDiameter);
        }

        D.AssertEqual(GameInputMode.Normal, _inputMgr.InputMode, _inputMgr.InputMode.GetValueName());  // Occlusion check should only occur during Normal InputMode

        bool isObjectOccluded = false;
        occludedObject = null;
        occludedSystem = null;

        if (!UICamera.isOverUI) {
            RaycastHit hit;
            Ray ray = UICamera.lastWorldRay;    // Ngui 3.11.0 introduced UICamera.lastWorldRay // Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, _universeDiameter, _occludedObjectDetectionMask)) {
                occludedObject = hit.collider.gameObject;
                //D.Log(ShowDebugLog, "{0} found occluded object {1}. \nMask = {2}.", DebugName, occludedObject.name, _occludedObjectDetectionMask.MaskToString());
                isObjectOccluded = true;
            }
            else {
                // No non-system object found, so now try to find another system orbital plane
                int hitCount = Physics.RaycastNonAlloc(ray, _occludedSystemHitBuffer, _universeDiameter, _occludedSystemDetectionMask);
                D.Assert(hitCount > Constants.Zero); // must at least hit this orbital plane
                if (hitCount > Constants.One) {
                    occludedObject = _occludedSystemHitBuffer[1].collider.gameObject;
                    OrbitalPlaneInputEventRouter systemPlaneRouter = occludedObject.GetComponent<OrbitalPlaneInputEventRouter>();
                    occludedSystem = systemPlaneRouter.System;
                    //D.Log(ShowDebugLog, "{0} found occluded System {1}. \nMask = {2}.", DebugName, occludedSystem.DebugName, _occludedSystemDetectionMask.MaskToString());
                    isObjectOccluded = true;
                }
            }
        }
        return isObjectOccluded;
    }
    /// <summary>
    /// Assigns a configuration to the provided existing DebugSettlementCreator, using the DeployDate provided.
    /// <remarks>The DebugCreator's EditorSettings specifying the DeployDate will be ignored.</remarks>
    /// </summary>
    /// <param name="creator">The creator.</param>
    /// <param name="owner">The owner.</param>
    /// <param name="system">The system to assign the settlement creator to.</param>
    /// <param name="deployDate">The deploy date.</param>
    public void AssignConfigurationToExistingCreator(DebugSettlementCreator creator, Player owner, SystemItem system, GameDate deployDate) {
        var editorSettings = creator.EditorSettings as BaseCreatorEditorSettings;

        ValidateOwner(owner, editorSettings);

        string unitName = editorSettings.UnitName;
        string cmdDesignName = MakeAndRecordSettlementCmdDesign(owner, editorSettings.UnitName, editorSettings.CMsPerCommand, editorSettings.Formation.Convert());
        var hullStats = CreateFacilityHullStats(editorSettings, isSettlement: true);
        IList<string> elementDesignNames = MakeAndRecordFacilityDesigns(owner, hullStats, editorSettings.LosTurretsPerElement,
            editorSettings.MissileLaunchersPerElement, editorSettings.PassiveCMsPerElement, editorSettings.ActiveCMsPerElement,
            editorSettings.SensorsPerElement, editorSettings.ShieldGeneratorsPerElement);
        UnitCreatorConfiguration config = new UnitCreatorConfiguration(unitName, owner, deployDate, cmdDesignName, elementDesignNames);
        creator.Configuration = config;
        SystemFactory.Instance.InstallCelestialItemInOrbit(creator.gameObject, system.SettlementOrbitData);
        D.Log(ShowDebugLog, "{0} has installed a {1} for {2} in System {3}.", DebugName, typeof(DebugSettlementCreator).Name, owner, system.DebugName);
    }
예제 #32
0
    protected virtual void MakeSystem() {
        LogEvent();
        FocusableItemCameraStat cameraStat = MakeSystemCameraStat();
        _system = _systemFactory.MakeSystemInstance(SystemName, gameObject, cameraStat);
        if (!_system.gameObject.isStatic) {
            D.Error("{0} should be static after being positioned.", _system.DebugName);
        }

        _system.SettlementOrbitData = InitializeSettlementOrbitSlot();
        SectorGrid.Instance.GetSector(_system.SectorID).System = _system;
    }
예제 #33
0
 public SystemItem Put([FromBody] SystemItem value)
 {
     return(BLL.SystemConfigBLL.Update(value));
 }
 /// <summary>
 /// Assigns a configuration to the provided existing DebugSettlementCreator, using the DeployDate specified by the DebugCreator.
 /// </summary>
 /// <param name="creator">The creator.</param>
 /// <param name="owner">The owner.</param>
 /// <param name="system">The system to assign the settlement creator to.</param>
 public void AssignConfigurationToExistingCreator(DebugSettlementCreator creator, Player owner, SystemItem system) {
     GameDate deployDate = creator.EditorSettings.DateToDeploy;
     AssignConfigurationToExistingCreator(creator, owner, system, deployDate);
 }
    /// <summary>
    /// Generates a random settlement creator, places it in orbit around <c>system</c> and deploys it on the provided date.
    /// </summary>
    /// <param name="owner">The owner.</param>
    /// <param name="system">The system.</param>
    /// <param name="deployDate">The deploy date.</param>
    /// <returns></returns>
    public SettlementCreator GenerateRandomAutoSettlementCreator(Player owner, SystemItem system, GameDate deployDate) {
        string unitName = GetUniqueUnitName("AutoSettlement");
        int cmsPerCmd = RandomExtended.Range(0, 3);
        Formation formation = Enums<Formation>.GetRandomExcept(Formation.Wedge, default(Formation));
        string cmdDesignName = MakeAndRecordSettlementCmdDesign(owner, unitName, cmsPerCmd, formation);

        int elementQty = RandomExtended.Range(1, TempGameValues.MaxFacilitiesPerBase);
        var hullStats = CreateFacilityHullStats(elementQty, isSettlement: true);
        var turretLoadout = DebugLosWeaponLoadout.Random;
        var missileLoadout = DebugWeaponLoadout.Random;
        int elementPassiveCMs = RandomExtended.Range(0, 3);
        int elementActiveCMs = RandomExtended.Range(0, 3);
        int elementSensors = RandomExtended.Range(1, 5);
        int elementShieldGens = RandomExtended.Range(0, 3);
        var elementDesignNames = MakeAndRecordFacilityDesigns(owner, hullStats, turretLoadout, missileLoadout, elementPassiveCMs, elementActiveCMs, elementSensors, elementShieldGens);

        UnitCreatorConfiguration config = new UnitCreatorConfiguration(unitName, owner, deployDate, cmdDesignName, elementDesignNames);
        D.Log(ShowDebugLog, "{0} has placed a random {1} for {2} in orbit in System {3}.", DebugName, typeof(SettlementCreator).Name, owner, system.DebugName);
        return UnitFactory.Instance.MakeSettlementCreatorInstance(config, system);
    }
    /// <summary>
    /// Generates a random settlement creator, places it in orbit around <c>system</c> and deploys it on a random date.
    /// </summary>
    /// <param name="owner">The owner.</param>
    /// <param name="system">The system.</param>
    /// <returns></returns>
    public SettlementCreator GenerateRandomAutoSettlementCreator(Player owner, SystemItem system) {
        GameTimeDuration deployDateDelay = new GameTimeDuration(UnityEngine.Random.Range(Constants.ZeroF, 3F));
        //GameTimeDuration deployDateDelay = new GameTimeDuration(5F);
        GameDate deployDate = GameTime.Instance.GenerateRandomFutureDate(deployDateDelay);

        return GenerateRandomAutoSettlementCreator(owner, system, deployDate);
    }
예제 #37
0
 public SystemCtxControl(SystemItem system)
     : base(system.gameObject, uniqueSubmenusReqd: Constants.One, menuPosition: MenuPositionMode.AtCursor) {
     _systemMenuOperator = system;
 }
예제 #38
0
        public static bool Delete(SystemItem param)
        {
            var dbContext = new DbContext();

            return(dbContext.SystemConfigDb.Delete(param));
        }
예제 #39
0
    private void MakeSystem() {
        LogEvent();

        if (!IsSystemNamed) {
            transform.name = SystemNameFactory.Instance.GetUnusedName();
            D.Assert(IsSystemNamed);
        }

        FocusableItemCameraStat cameraStat = MakeSystemCameraStat();
        if (IsCompositionPreset) {
            _system = gameObject.GetSingleComponentInChildren<SystemItem>();
            _systemFactory.PopulateSystemInstance(SystemName, cameraStat, ref _system);
        }
        else {
            _system = _systemFactory.MakeSystemInstance(SystemName, gameObject, cameraStat);
        }
        D.Assert(_system.gameObject.isStatic, "{0} should be static after being positioned.", _system.FullName);

        _system.IsTrackingLabelEnabled = IsTrackingLabelEnabled;
        SectorGrid.Instance.GetSector(_system.SectorIndex).System = _system;
    }
 public SystemCtxControl_User(SystemItem system)
     : base(system.Settlement, system.gameObject) {
     D.Assert(system.Settlement != null);
     _system = system;
 }
예제 #41
0
 public SystemCtxControl_AI(SystemItem system)
     : base(system.gameObject, uniqueSubmenusReqd: Constants.Zero, menuPosition: MenuPositionMode.AtCursor) {
     _systemMenuOperator = system;
     _settlement = system.Settlement;
     D.AssertNotNull(_settlement);
 }