Esempio n. 1
0
 private void BindingData()
 {
     try
     {
         UnitsCollection col = null;
         col = this.LoadData(txtSearch.Text.Trim());
         if (col == null)
         {
             col                = new UnitsCollection();
             lblcount.Text      = "Có 0" + " record";
             rptData.DataSource = col;
             rptData.DataBind();
         }
         else
         {
             lblcount.Text          = "Có " + col.Count.ToString() + " record";
             lblcount.ForeColor     = System.Drawing.Color.Blue;
             anpPager.RecordCount   = col.Count;
             anpPager.PageSize      = Convert.ToInt32(ddlPageSize.SelectedValue);
             anpPager.ShowFirstLast = false;
             col = this.GetSubData(col, anpPager.StartRecordIndex - 1, anpPager.EndRecordIndex);
             rptData.DataSource = col;
             rptData.DataBind();
         }
     }
     catch (Exception ex)
     {
         Global.WriteLogError("BindingData()" + ex);
     }
 }
Esempio n. 2
0
 public void CreateNewQueue(UnitsCollection units)
 {
     unitsTurnQueue.Clear();
     foreach (var unit in units)
     {
         unitsTurnQueue.Enqueue(unit, -unit.speed);
     }
 }
        /// <summary>
        /// Helper for initializing unit groups
        /// </summary>
        private void InitializeUnitGroups () {
            GameObject playerUnitsObj = Stage.transform.Find("Player Units").gameObject;
            GameObject enemyUnitsObj = Stage.transform.Find("Enemy Units").gameObject;

            PlayerUnitGroupController = playerUnitsObj.GetComponent<UnitGroupController>();
            EnemyUnitGroupController = enemyUnitsObj.GetComponent<UnitGroupController>();

            PlayerUnits = PlayerUnitGroupController.Units;
            EnemyUnits = EnemyUnitGroupController.Units;
        }
Esempio n. 4
0
        public CardsNewDBScene(CardsNewDBLevel _Level) : base(_Level, _Level.Sets.Name)
        {
            this.Level    = _Level;
            Sets          = new SceneSets(_Level, this);
            numberDBLevel = _Level;
            GetComponent <Loader>().LoadSets    = LoadSets;
            GetComponent <Loader>().LoadContent = LoadContent;

            GetComponent <Starter>().StartElements.Add(Start);

            UnitsCol        = new UnitsCollection <CardUnit>("UnitsCollection", this);
            ReadyToNextUnit = true;
        }
Esempio n. 5
0
    private UnitsCollection GetSubData(UnitsCollection Source, int start, int end)
    {
        int             iTotalRecord = Source.Count;
        UnitsCollection subSource    = new UnitsCollection();

        if (Source != null)
        {
            for (int i = start; i < end; i++)
            {
                subSource.Add(Source[i]);
            }
        }
        return(subSource);
    }
Esempio n. 6
0
    private UnitsCollection LoadData(string stextsearch)
    {
        Data            objdata = new Data(Global.ConnectionSql);
        UnitsCollection col     = null;

        try
        {
            Units obj = new Units();
            obj.DataObject = objdata;
            col            = obj.Getlist(stextsearch);
        }
        catch (Exception ex)
        {
            Global.WriteLogError("LoadData()" + ex);
        }
        finally
        {
            objdata.DeConnect();
        }
        return(col);
    }
Esempio n. 7
0
        private void LoadSeverities(string fullPath)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            UnitsCollection.Clear();
            Totals.Clear();
            ClearDatasets();

            if (File.Exists(fullPath))
            {
                var watch = System.Diagnostics.Stopwatch.StartNew();

                FileStream fileStream = File.Open(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                using (BinaryReader reader = new BinaryReader(fileStream))
                {
                    // Read version
                    uint thisVersion = reader.ReadUInt32();
                    if (thisVersion == VERSION)
                    {
                        // Read Header
                        Timeline.CompilerTimeline.Instance.TimelinePacking = reader.ReadUInt32();

                        // Read Units
                        uint unitsLength = reader.ReadUInt32();
                        var  unitList    = new List <UnitValue>((int)unitsLength);
                        for (uint i = 0; i < unitsLength; ++i)
                        {
                            ReadCompileUnit(reader, unitList, i);
                        }

                        UnitsCollection = new List <UnitValue>(unitList);

                        //Read Datasets
                        for (int i = 0; i < (int)CompileThresholds.Gather; ++i)
                        {
                            uint dataLength = reader.ReadUInt32();
                            var  thislist   = new List <CompileValue>((int)dataLength);
                            for (uint k = 0; k < dataLength; ++k)
                            {
                                ReadCompileValue(reader, thislist);
                            }
                            Datasets[i].collection = new List <CompileValue>(thislist);
                        }
                    }
                    else
                    {
                        OutputLog.Error("Version mismatch! Expected " + VERSION + " - Found " + thisVersion + " - Please export again with matching Data Exporter");
                    }
                }

                fileStream.Close();

                //Post process on read data
                PostProcessLoadedData();

                watch.Stop();
                const long TicksPerMicrosecond = (TimeSpan.TicksPerMillisecond / 1000);
                ulong      microseconds        = (ulong)(watch.ElapsedTicks / TicksPerMicrosecond);
                OutputLog.Log("Score file processed in " + Common.UIConverters.GetTimeStr(microseconds));
            }

            RecomputeSeverities();

            ScoreDataChanged?.Invoke();
        }
Esempio n. 8
0
 public CardsNewDBIteration(Scene _Scene) : base(new IterationSets(), _Scene, "Iteration1")///ЗАТЫЧКА получилась
 {
     UnitsCollection <CardUnit> units = new UnitsCollection <CardUnit>("Units", this);
 }
 /// <summary>
 /// Initialize reticle and targeting state to default
 /// </summary>
 private void Reinitialize () {
     if (Controller.playerTurn) {
         MoveablePlayerUnits = new UnitsCollection(Controller.PlayerUnits.Living());
         Currently = TargetingState.Selecting;
     }
 }
 /// <summary>
 /// Set current state
 /// </summary>
 /// <param name="targets">Allowed targers</param>
 /// <param name="current">Initally selecte unit</param>
 private void SetState (UnitsCollection targets, Unit current) {
     AllowedTargets = targets.Living();
     TargetsEnumerator = AllowedTargets.GetEnumerator();
     TargetsEnumerator.MoveNext();
     current = TargetsEnumerator.Current;
     Reticle.Attach(current);
 }
 void Start () {
     targets = TargetGroup.GetComponent<UnitGroupController>().Units;
     enemyObj = transform.parent.gameObject;
     enemy = enemyObj.GetComponent<Unit>();
 }