示例#1
0
        /// <summary>
        /// Run the data query & return the data via a query manager
        /// </summary>
        /// <param name="dataQuery"></param>
        /// <returns>The displayQuery which may be the original dataQuery or a modified version of it</returns>

        Query RunQuery(
            Query dataQuery)
        {
            DataRowMx dr;
            int       rowCount = 0;

            List <string> keyList;
            QueryManager  qm           = new QueryManager();
            Query         displayQuery = dataQuery;

            qm.ExecuteQuery(ref displayQuery, out keyList);
            DataTableManager dtm = qm.DataTableManager;

            while (true)
            {
                dr = dtm.FetchNextDataRow(false);
                if (dr == null)
                {
                    break;
                }
                if (dtm.RowRetrievalCancelled)
                {
                    Cancelled = true;
                    return(null);
                }
                rowCount++;
            }

            return(displayQuery);
        }
示例#2
0
    public void Awake()
    {
        GameObject go = GameObject.Find("GlobalScripts");

        if (go != null)
        {
            MLSNetManager = go.GetComponent(typeof(LSNetManager)) as LSNetManager;
            MGSNetManager = go.GetComponent(typeof(GSNetManager)) as GSNetManager;

            MDataTableManager = go.GetComponent(typeof(DataTableManager)) as DataTableManager;
            MGameDataManager  = go.GetComponent(typeof(GameDataManager)) as GameDataManager;
            MHQGeneralManager = go.GetComponent(typeof(HQGeneralManager)) as HQGeneralManager;

            MGUIManager       = go.GetComponent(typeof(GUIManager)) as GUIManager;
            MGUILayoutManager = go.GetComponent(typeof(GUILayoutManager)) as GUILayoutManager;

            MSceneManager = go.GetComponent(typeof(SceneManager)) as SceneManager;

            MPlayerManager = go.GetComponent(typeof(PlayerManager)) as PlayerManager;
            MNpcManager    = go.GetComponent(typeof(NpcManager)) as NpcManager;
            MSkillManager  = go.GetComponent(typeof(SkillManager)) as SkillManager;

            MTaskManager = go.GetComponent <TaskManager>() as TaskManager;

            M3DItemManager = go.GetComponent <EZ3DItemManager>() as EZ3DItemManager;

            MConnectManager      = go.GetComponent <NativeConnectManager>() as NativeConnectManager;
            MRepeateEventManager = go.GetComponent <RepeateEventManager>() as RepeateEventManager;

            MAffectorManager = go.GetComponent <AffectorManager>() as AffectorManager;
            MEffectManager   = go.GetComponent(typeof(EffectManager)) as EffectManager;
            MSoundManager    = go.GetComponent(typeof(SoundManager)) as SoundManager;

            MCopySweepManager = go.GetComponent(typeof(CopySweepManager)) as CopySweepManager;

            MFingerEvent        = go.GetComponent <FingerEvent>() as FingerEvent;
            MCameraController   = go.GetComponentInChildren <CameraController>() as CameraController;
            MCamTrackController = go.GetComponentInChildren <CameraTrackController>() as CameraTrackController;

            MTeachManager    = go.GetComponent(typeof(TeachManager)) as TeachManager;
            MGUIDataManager  = go.GetComponent(typeof(GUIDataManager)) as GUIDataManager;
            MPushDataManager = go.GetComponent(typeof(PushDataManager)) as PushDataManager;

            MBundleManager      = go.GetComponent(typeof(BundleManager)) as BundleManager;
            MResourceManager    = go.GetComponent <ResourceMgr>() as ResourceMgr;
            MPortDefenseManager = go.GetComponent <PortDefenseManager>() as PortDefenseManager;
            MPortVieManager     = go.GetComponent <PortVieManager>() as PortVieManager;
            MJunHunManager      = go.GetComponent <JunHunManager>() as JunHunManager;
            MJobManager         = go.GetComponent <JobManager>() as JobManager;
            mArenaInfoManager   = go.GetComponent <ArenaInfoManager> () as ArenaInfoManager;
            mProduceManager     = go.GetComponent <ProduceManager>() as ProduceManager;
            mEvolutionManager   = go.GetComponent <EvolutionManager>() as EvolutionManager;
            mShopDataManager    = go.GetComponent <ShopDataManager>() as ShopDataManager;
            MStarter            = go.GetComponent <Starter>();
        }
    }
    private void Start()
    {
        m_DataTableManager = FrameworkEntry.Instance.GetManager <DataTableManager>();
        m_DataTableManager.LoadDataTable <DRAircraft>("Aircraft", "Aircraft");

        DataTable <DRAircraft> aircraftTable = m_DataTableManager.GetDataTable <DRAircraft>();
        DRAircraft             aircraft      = aircraftTable[10000]; //这里要给战机编号

        Debug.Log(aircraft.Id);
    }
        public void buildEvaluationExel(string path)
        {
            DataTable dt = DataTableManager.prepareEvalTable(this.factors, this.personalAnswers);

            if (path.EndsWith(".xlsx"))
            {
                Exporter.exportExel(path, dt);
            }
            else if (path.EndsWith(".csv"))
            {
                Exporter.exportCsv(path, ";", dt);
            }
        }
    private IEnumerator Start()
    {
        LoadingQueue load_queue        = new LoadingQueue(this);
        LoadObject   lo_common_prefabs = load_queue.Load(RESOURCE_CATEGORY.SYSTEM, "SystemCommon", new string[2]
        {
            "MainCamera",
            "InputManager"
        }, false);
        LoadObject lo_field_map_table = load_queue.Load(RESOURCE_CATEGORY.TABLE, "FieldMapTable", false);
        LoadObject lo_portal_table    = load_queue.Load(RESOURCE_CATEGORY.TABLE, "FieldMapPortalTable", false);
        LoadObject lo_enemy_pop_table = load_queue.Load(RESOURCE_CATEGORY.TABLE, "FieldMapEnemyPopTable", false);

        while (load_queue.IsLoading())
        {
            yield return((object)null);
        }
        MonoBehaviourSingleton <AppMain> .I.get_gameObject().AddComponent <FieldManager>();

        Singleton <FieldMapTable> .Create();

        string csv3 = DataTableManager.Decrypt((lo_field_map_table.loadedObject as TextAsset).get_text());

        Singleton <FieldMapTable> .I.CreateFieldMapTable(csv3);

        csv3 = DataTableManager.Decrypt((lo_portal_table.loadedObject as TextAsset).get_text());
        Singleton <FieldMapTable> .I.CreatePortalTable(csv3);

        csv3 = DataTableManager.Decrypt((lo_enemy_pop_table.loadedObject as TextAsset).get_text());
        Singleton <FieldMapTable> .I.CreateEnemyPopTable(csv3);

        if (Camera.get_main() != null)
        {
            Object.DestroyImmediate(Camera.get_main().get_gameObject());
        }
        ResourceUtility.Realizes(lo_common_prefabs.loadedObjects[0].obj, MonoBehaviourSingleton <AppMain> .I._transform, -1);
        ResourceUtility.Realizes(lo_common_prefabs.loadedObjects[1].obj, MonoBehaviourSingleton <AppMain> .I._transform, -1);
        MonoBehaviourSingleton <AppMain> .I.SetMainCamera(Camera.get_main());

        MonoBehaviourSingleton <AudioListenerManager> .I.SetFlag(AudioListenerManager.STATUS_FLAGS.CAMERA_MAIN_ACTIVE, true);

        MonoBehaviourSingleton <AppMain> .I.get_gameObject().AddComponent <WorldMapManager>();

        MonoBehaviourSingleton <AppMain> .I.get_gameObject().AddComponent <FilterManager>();

        MonoBehaviourSingleton <UIManager> .I.SetDisable(UIManager.DISABLE_FACTOR.INITIALIZE, false);

        MonoBehaviourSingleton <AppMain> .I.startScene = string.Empty;
        MonoBehaviourSingleton <GameSceneManager> .I.ChangeScene("Title", "Opening", UITransition.TYPE.CLOSE, UITransition.TYPE.OPEN, false);
    }
示例#6
0
    public void Awake()
    {
        Instance = this;

        DataTableManager = new DataTableManager();
        DataTableManager.LoadTownTable(TestData.TownInfoTable);
        DataTableManager.FleetInfo = TestData.Fleet;
        DataTableManager.LoadCommodityTable(TestData.CommodityTable);
        var save = TestData.Saves;

        EntityList = new List<Entity>();

        //创建城镇
        GameDataManager = new GameObject("GameDataManager").AddComponent<GameDataManager>();
        GameDataManager.TownList = new List<Town>();
        foreach (var townInfo in DataTableManager.TownTable.Values)
        {
            var town = new Town();
            town.Info = townInfo;
            var townSave = save.TownList.Find(x => x.ID == townInfo.ID);
            if (null != townSave)
            {
                town.LoadSave(townSave);
            }
            GameDataManager.TownList.Add(town);
            EntityList.Add(town);
            town.Reset();
        }

        Map.Setup(GameDataManager.TownList);

        //创建舰队
        var fleet = new Fleet();
        fleet.Info = DataTableManager.FleetInfo;
        fleet.Position = new Vector2(0, 0);
        fleet.Actor = Map.transform.Find("Fleet").GetComponent<FleetActor>();
        fleet.Actor.Model = fleet;
        fleet.Reset();
        EntityList.Add(fleet);
        FocusedFleet = fleet;

        WorldTime = 0;
        TickCountDownRemaining = 0;
        //CurrentTownSettleSeconds = -1;
    }
示例#7
0
    private void ShowDialogue(DialogueData dialogue)
    {
        this.dialogue = dialogue;


        portrait.sprite = dialogue.Portrait;


        DataTableManager dataTableManager = DataTableManager.singleton;

        string speakerName = dataTableManager.GetText(dialogue.TextID_Speaker);
        string content     = dataTableManager.GetText(dialogue.TextID_Content);


        textField.text = StripAllCommands(speakerName + "\n" + content);

        //We now hide text based on each character's alpha value
        HideText(speakerName.Length + 1);
    }
示例#8
0
	void Start () {
        DataTableManager manager = new DataTableManager();
        manager.OnInit();

        Data data = manager.TryGetValue<Data>(1);
        Debug.LogError(data.ut_string);
        data.extend = 1111.001f;

        DataDataReader reader = manager.TryGetReader<Data>() as DataDataReader;

        foreach (var item in reader.Data)
        {
            Debug.LogErrorFormat("data {0}, extend {1}", item.Value.id, item.Value.extend);

            foreach (var kv in item.Value.ut_map)
            {
                Debug.LogFormat("map {0}, {1}", kv.Key, kv.Value);
            }
        }
    }
 private void buttonRunACP_Click(object sender, EventArgs e)
 {
     using (var form = new ACPForm(viewModel.getNumberOfQuestions()))
     {
         form.PropertyChanged += this.viewModel.Parallel;
         var result = form.ShowDialog();
         if (result == DialogResult.OK)
         {
             PCAResults results = this.viewModel.ACP(form.viewModel.factorNumber);
             if (results != null)
             {
                 dataGridPrincipalComponents.DataSource = DataTableManager.PCATableToDataTable(results.pcaTable);
                 dataGridPCALoadings.DataSource         = DataTableManager.PCALoadingstoDataTable(results.loadings);
             }
             else
             {
                 MessageBox.Show("An error has been occured or number of chosen factors is more than the number of questions", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             factorisationResults.Visible = true;
         }
     }
 }
示例#10
0
        public BillingResult Post([FromBody] BillingModel model)
        {
            HttpContext.Current.Server.ScriptTimeout = 1800;

            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            DateTime start = DateTime.Now;

            int clientId = (model.ClientID == 0) ? -1 : model.ClientID;

            bool success = true;

            int             count;
            string          message = string.Empty;
            string          subject = "Data.Controllers.ApiBillingController.Post";
            LogMessageLevel level   = LogMessageLevel.Info;

            ProcessResult result;

            string context = "Data.Controllers.ApiBillingController.Post";

            if (model.StartPeriod != DateTime.MinValue)
            {
                if (model.EndPeriod == DateTime.MinValue)
                {
                    model.EndPeriod = model.StartPeriod.AddMonths(1);
                }

                using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cnSselData"].ConnectionString))
                {
                    conn.Open();

                    BillingDataProcessStep1 step1 = new BillingDataProcessStep1(new Step1Config {
                        Connection = conn, ClientID = clientId, IsTemp = model.IsTemp, Period = model.StartPeriod, Now = DateTime.Now, Context = context
                    });
                    BillingDataProcessStep2        step2;
                    BillingDataProcessStep3        step3;
                    BillingDataProcessStep4Subsidy step4;

                    switch (model.Command)
                    {
                    case "tool-data-clean":
                        result = new WriteToolDataCleanProcess(new WriteToolDataCleanConfig {
                            Connection = conn, StartDate = model.StartPeriod, EndDate = model.EndPeriod, ClientID = clientId, Context = context
                        }).Start();
                        message += result.LogText;
                        break;

                    case "room-data-clean":
                        result = new WriteRoomDataCleanProcess(new WriteRoomDataCleanConfig {
                            Connection = conn, StartDate = model.StartPeriod, EndDate = model.EndPeriod, ClientID = clientId, RoomID = model.RoomID, Context = context
                        }).Start();
                        message += result.LogText;
                        break;

                    case "store-data-clean":
                        result = new WriteStoreDataCleanProcess(new WriteStoreDataCleanConfig {
                            Connection = conn, StartDate = model.StartPeriod, EndDate = model.EndPeriod, ClientID = clientId, Context = context
                        }).Start();
                        message += result.LogText;
                        break;

                    case "tool-data":
                        result = new WriteToolDataProcess(new WriteToolDataConfig {
                            Connection = conn, Period = model.StartPeriod, ClientID = clientId, ResourceID = model.ResourceID, Context = context
                        }).Start();
                        message += result.LogText;
                        break;

                    case "room-data":
                        result = new WriteRoomDataProcess(new WriteRoomDataConfig {
                            Connection = conn, Period = model.StartPeriod, ClientID = clientId, RoomID = model.RoomID, Context = context
                        }).Start();
                        message += result.LogText;
                        break;

                    case "store-data":
                        result = new WriteStoreDataProcess(new WriteStoreDataConfig {
                            Connection = conn, Period = model.StartPeriod, ClientID = clientId, ItemID = model.ItemID, Context = context
                        }).Start();
                        message += result.LogText;
                        break;

                    case "tool-billing-step1":
                        result   = step1.PopulateToolBilling();
                        message += result.LogText;
                        break;

                    case "room-billing-step1":
                        result   = step1.PopulateRoomBilling();
                        message += result.LogText;
                        break;

                    case "store-billing-step1":
                        result   = step1.PopulateStoreBilling();
                        message += result.LogText;
                        break;

                    case "tool-billing-step2":
                        step2    = new BillingDataProcessStep2(conn);
                        count    = step2.PopulateToolBillingByAccount(model.StartPeriod, clientId);
                        message += $"Tool Step2 By Account: count = {count}";
                        count    = step2.PopulateToolBillingByToolOrg(model.StartPeriod, clientId);
                        message += $"{Environment.NewLine}Tool Step2 By Tool Org: count = {count}";
                        break;

                    case "room-billing-step2":
                        step2    = new BillingDataProcessStep2(conn);
                        count    = step2.PopulateRoomBillingByAccount(model.StartPeriod, clientId);
                        message += $"Room Step2 By Account: count = {count}";
                        count    = step2.PopulateRoomBillingByRoomOrg(model.StartPeriod, clientId);
                        message += $"{Environment.NewLine}Room Step2 By Room Org: count = {count}";
                        break;

                    case "store-billing-step2":
                        step2    = new BillingDataProcessStep2(conn);
                        count    = step2.PopulateStoreBillingByAccount(model.StartPeriod, clientId);
                        message += $"Store Step2 By Account: count = {count}";
                        count    = step2.PopulateStoreBillingByItemOrg(model.StartPeriod, clientId);
                        message += $"{Environment.NewLine}Store Step2 By Item Org: count = {count}";
                        break;

                    case "tool-billing-step3":
                        step3    = new BillingDataProcessStep3(conn);
                        count    = step3.PopulateToolBillingByOrg(model.StartPeriod, clientId);
                        message += $"Tool Step3 By Org: count = {count}";
                        break;

                    case "room-billing-step3":
                        step3    = new BillingDataProcessStep3(conn);
                        count    = step3.PopulateRoomBillingByOrg(model.StartPeriod, clientId);
                        message += $"Room Step3 By Org: count = {count}";
                        break;

                    case "store-billing-step3":
                        step3    = new BillingDataProcessStep3(conn);
                        count    = step3.PopulateStoreBillingByOrg(model.StartPeriod);
                        message += $"Store Step3 By Org: count = {count}";
                        break;

                    case "subsidy-billing-step4":
                        step4 = new BillingDataProcessStep4Subsidy(new Step4Config {
                            Connection = conn, Period = model.StartPeriod, ClientID = clientId, Context = context
                        });
                        result   = step4.PopulateSubsidyBilling();
                        message += result.LogText;
                        break;

                    case "subsidy-distribution":
                        step4 = new BillingDataProcessStep4Subsidy(new Step4Config {
                            Connection = conn, Period = model.StartPeriod, ClientID = clientId, Context = context
                        });
                        step4.DistributeSubsidyMoneyEvenly();
                        message += "Subsidy distribution: complete";
                        break;

                    case "finalize-data-tables":
                        result   = DataTableManager.Create(Provider).Finalize(model.StartPeriod);
                        message += result.LogText;
                        break;

                    default:
                        success  = false;
                        message += $"Unknown command: {model.Command}";
                        level    = LogMessageLevel.Error;
                        break;
                    }
                }
            }
            else
            {
                success  = false;
                message += $"Missing parameter: StartPeriod [{model.StartPeriod:yyyy-MM-dd HH:mm:ss}]";
                level    = LogMessageLevel.Error;
            }

            Log.Write(level, subject, message, null);

            DateTime end = DateTime.Now;

            return(new BillingResult()
            {
                Success = success,
                Command = model.Command,
                Description = subject,
                StartDate = start,
                EndDate = end,
                TimeTaken = (end - start).TotalSeconds,
                LogText = message
            });
        }
示例#11
0
    /// <summary>
    /// 用來作初始化
    /// </summary>
    void Start()
    {
        _gameGUIPanel = GameGUIPanel.Instance;

        _gameState = GameNone.Instance;
        _dataTableManager = new DataTableManager();
        _sceneManager = new SceneManager();
        _playerInput = PlayerInput.Instance;
        _cameraManager = new CameraManager();
        _gameEventManager = new GameEventManager();
        _gameEventState = new GameEventState();

        _npcUnitManager = NPCUnitManager.Instance;

        // 進入遊戲前需處理好的class,加載位置可能要換
        _startDependencies.Add(_dataTableManager);
    }
示例#12
0
 void OnDestroy()
 {
     _gameGUIPanel = null;
     _gameState = null;
     _dataTableManager = null;
     _sceneManager = null;
     if (_playerInput != null)
     {
         Destroy(_playerInput);
         _playerInput = null;
     }
     _cameraManager = null;
     _gameEventManager = null;
     _gameEventState = null;
     if (_npcUnitManager != null)
     {
         Destroy(_npcUnitManager);
         _npcUnitManager = null;
     }
     _instance = null;
 }
    public void CreateTableFromInternal(string encrypted_csv_text)
    {
        string csv_text = DataTableManager.Decrypt(encrypted_csv_text);

        CreateTable(csv_text);
    }
示例#14
0
        /// <summary>
        /// OK button clicked, process input
        /// </summary>
        /// <returns></returns>

        DialogResult ProcessInput()
        {
            int           rgCount;                              // number of Rgroups
            List <Rgroup> rgList;                               // list of existing Rgroups

            bool[]        rgExists;                             // entry = true if rgroup exists in core
            Rgroup        rg;
            bool          oneD, twoD;                           // matrix dimensionality
            List <string> keys = null;
            Dictionary <string, List <QualifiedNumber> > mElem; // matrix element dictionary

            List <RgroupSubstituent>[] rSubs;                   // substituents seen for each Rgroup
            Query        q, q0, q2;
            QueryTable   qt, qt2;
            QueryColumn  qc, qc2;
            MetaTable    mt, mt2;
            MetaColumn   mc, mc2;
            DataTableMx  dt;
            DataRowMx    dr;
            DialogResult dlgRslt;
            string       tok;
            int          ri, rii, si, qti, qci, bi, bi2;

            // Get core structure & list of R-groups

            MoleculeMx core = new MoleculeMx(MoleculeFormat.Molfile, SQuery.MolfileString);

            if (core.AtomCount == 0)
            {
                MessageBoxMx.ShowError("A Core structure with R-groups must be defined");
                return(DialogResult.None);
            }

            if (!Structure.Checked && !Smiles.Checked && !Formula.Checked &&
                !Weight.Checked && !Index.Checked)
            {
                MessageBoxMx.ShowError("At least one substituent display format must be selected.");
                return(DialogResult.None);
            }

            mt = MetaTableCollection.GetWithException("Rgroup_Decomposition");
            qt = new QueryTable(mt);
            qc = qt.GetQueryColumnByNameWithException("Core");

            qc.MolString       = core.GetMolfileString();       // put core structure into table criteria
            qc.CriteriaDisplay = "Substructure search (SSS)";
            qc.Criteria        = "CORE SSS SQUERY";

            qc = qt.GetQueryColumnByNameWithException("R1_Structure");
            if (ShowCoreStructure.Checked)
            {
                qc.Label            = "R-group, Core\tChime=" + core.GetChimeString();      // reference core in query col header label
                qc.MetaColumn.Width = 25;
            }

            RgroupDecomposition.SetSelected(qt, "R1_Structure", Structure.Checked);             // select for retrieval if checked
            RgroupDecomposition.SetSelected(qt, "R1_Smiles", Smiles.Checked);
            RgroupDecomposition.SetSelected(qt, "R1_Formula", Formula.Checked);
            RgroupDecomposition.SetSelected(qt, "R1_Weight", Weight.Checked);
            RgroupDecomposition.SetSelected(qt, "R1_SubstNo", Index.Checked);

            string terminateOption = "First mapping";             // terminate on first complete match

            qc                 = qt.GetQueryColumnByNameWithException("Terminate_Option");
            qc.Criteria        = qt.MetaTable.Name + " = " + Lex.AddSingleQuotes(terminateOption);
            qc.CriteriaDisplay = "= " + Lex.AddSingleQuotes(terminateOption);

            QueryTable rgdQt = qt;             // keep a ref to it

            if (QbUtil.Query == null || QbUtil.Query.Tables.Count == 0)
            {
                MessageBoxMx.ShowError("No current query.");
                return(DialogResult.None);
            }

            q0 = QbUtil.Query;          // original query this analysis is based on
            q  = q0.Clone();            // make copy of source query we can modify
            q.SingleStepExecution = false;

            qti = 0;
            while (qti < q.Tables.Count)             // deselect query columns that we don't want
            {
                qt = q.Tables[qti];
                if (Lex.Eq(qt.MetaTable.Name, "Rgroup_Decomposition"))
                {                 // remove any rgroup decomp table
                    qti++;
                    continue;
                }

                mt = qt.MetaTable;
                if (mt.MultiPivot ||                                 // check for tables not allowed in underlying query
                    mt.MetaBrokerType == MetaBrokerType.CalcField || // (called ShouldPresearchAndTransform previously)
                    mt.MetaBrokerType == MetaBrokerType.MultiTable ||
                    mt.MetaBrokerType == MetaBrokerType.RgroupDecomp)
                {
                    MessageBoxMx.ShowError("Multipivot/Rgroup table \"" + qt.ActiveLabel +
                                           "\" can't be included in an underlying Rgroup Matrix query");
                    return(DialogResult.None);
                }

                for (qci = 0; qci < qt.QueryColumns.Count; qci++)
                {
                    qc = qt.QueryColumns[qci];
                    if (qc.MetaColumn == null)
                    {
                        continue;
                    }

                    switch (qc.MetaColumn.DataType)
                    {
                    case MetaColumnType.CompoundId:                             // keep only these
                    case MetaColumnType.Integer:
                    case MetaColumnType.Number:
                    case MetaColumnType.QualifiedNo:
                    case MetaColumnType.String:
                        break;

                    default:
                        qc.Selected = false;
                        break;
                    }
                }

                qti++;
            }

            q.AddQueryTable(rgdQt);             // Add Rgroup decom table to end of cloned source query

            Progress.Show("Retrieving data...");
            try
            {
                dlgRslt = ToolHelper.ExecuteQuery(ref q, out keys);
                if (dlgRslt != DialogResult.OK)
                {
                    return(dlgRslt);
                }
            }

            catch (Exception ex)
            {
                MessageBoxMx.ShowError("Error executing query:\r\n" + ex.Message);
                return(DialogResult.None);
            }

            if (keys == null || keys.Count == 0)
            {
                Progress.Hide();
                MessageBoxMx.ShowError("No results were returned by the query.");
                return(DialogResult.None);
            }

// Scan modified query to get list of rgroup indexes that are present

            rgExists = new bool[32];
            rgList   = new List <Rgroup>();

            QueryTable rgQt = q.GetQueryTableByName("Rgroup_Decomposition");

            foreach (QueryColumn qc0 in rgQt.QueryColumns)
            {
                mc = qc0.MetaColumn;
                if (!(mc.Name.StartsWith("R") && mc.Name.EndsWith("_STRUCTURE") && qc0.Selected))
                {
                    continue;                     // skip if not a selected Rgroup structure
                }
                int len = mc.Name.Length - ("R" + "_STRUCTURE").Length;
                tok = mc.Name.Substring(1, len);
                if (!int.TryParse(tok, out ri))
                {
                    continue;
                }
                rgExists[ri - 1] = true;
                rg        = new Rgroup();
                rg.RIndex = ri;
                rg.VoPos  = qc0.VoPosition;
                rgList.Add(rg);
            }

            for (bi = 1; bi < rgList.Count; bi++)
            {             // sort by increasing R index
                rg = rgList[bi];
                for (bi2 = bi - 1; bi2 >= 0; bi2--)
                {
                    if (rg.RIndex >= rgList[bi2].RIndex)
                    {
                        break;
                    }
                    rgList[bi2 + 1] = rgList[bi2];
                }

                rgList[bi2 + 1] = rg;
            }

            rgCount = rgList.Count;

            twoD = TwoD.Checked;
            if (rgCount == 1)
            {
                twoD = false;                           // if only 1 rgroup can't do as 2d
            }
            oneD = !twoD;

// Read data into mElem and rgroup substituents into rSubs.
// Matrix mElem is keyed on [R1Smiles, R2Smiles,... RnSmiles, FieldName] for 1d and
// [R1Smiles, R2Smiles,... FieldName, RnSmiles] for 2d

            QueryManager     qm  = q.QueryManager as QueryManager;
            DataTableManager dtm = qm.DataTableManager;

            dt = qm.DataTable;

            mElem = new Dictionary <string, List <QualifiedNumber> >(); // matrix element dictionary
            rSubs = new List <RgroupSubstituent> [32];                  // list of substituents seen for each Rgroup
            for (rii = 0; rii < rgCount; rii++)                         // alloc substituent list for rgroup
            {
                rSubs[rii] = new List <RgroupSubstituent>();
            }

            int rowCount = 0;

            while (true)
            {             // scan data accumulating rgroup substituents and data values
                dr = dtm.FetchNextDataRow();
                if (dr == null)
                {
                    break;
                }
                rowCount++;

                string cid = dr[dtm.KeyValueVoPos] as string;
                string lastMapCid = "", rgroupKey = "", rgroupKeyLast = "";
                int    mapCount = 0;
                for (rii = 0; rii < rgCount; rii++)                 // for
                {
                    MoleculeMx rSub = dr[rgList[rii].VoPos] as MoleculeMx;
                    if (rSub == null || rSub.AtomCount == 0)
                    {
                        continue;
                    }

                    ri = rgList[rii].RIndex;                     // actual R index in query
                    int subIdx = RgroupSubstituent.Get(rSub, rSubs[rii]);
                    //					if (ri == 1 && subIdx != 0) subIdx = subIdx; // debug
                    if (subIdx < 0)
                    {
                        continue;
                    }
                    string rKey = "R" + ri.ToString() + "_" + (subIdx + 1).ToString();

                    if (oneD || rii < rgCount - 1)
                    {
                        if (rgroupKey != "")
                        {
                            rgroupKey += "\t";
                        }
                        rgroupKey += rKey;
                    }

                    else
                    {
                        rgroupKeyLast = rKey;
                    }
                    lastMapCid = cid;
                    mapCount++;
                }

                if (lastMapCid == cid)                 // add the data if compound has a mapping
                {
                    AccumulateMatrixElements(mElem, q, dr, rgroupKey, rgroupKeyLast, cid);
                }

                if (Progress.IsTimeToUpdate)
                {
                    Progress.Show("Retrieving data: " + StringMx.FormatIntegerWithCommas(rowCount) + " rows...");
                }
            }
            if (rowCount == 0)
            {
                Progress.Hide();
                MessageBoxMx.ShowError("No data rows retrieved");
                return(DialogResult.None);
            }

            if (twoD && (rSubs[rgCount - 1] == null || rSubs[rgCount - 1].Count == 0))
            {             // if 2D be sure we have at least one substituent for the last Rgroup
                Progress.Hide();
                MessageBoxMx.ShowError("No substituents found for R" + rgCount.ToString());
                return(DialogResult.None);
            }

            // Create a MetaTable & DataTable for matrix results

            Progress.Show("Analyzing data...");

            mt = new MetaTable();             // create output table
            MatrixCount++;
            mt.Name           = "RGROUPMATRIX_" + MatrixCount;
            mt.Label          = "R-group Matrix " + MatrixCount;
            mt.MetaBrokerType = MetaBrokerType.RgroupDecomp;

            mc =                       // use sequence for key
                 mt.AddMetaColumn("RgroupMatrixId", "No.", MetaColumnType.Integer, ColumnSelectionEnum.Selected, 3);
            mc.ClickFunction = "None"; // avoid hyperlink on this key
            mc.IsKey         = true;

            int maxLeftR = rgCount;

            if (twoD)
            {
                maxLeftR = rgCount - 1;
            }
            for (ri = 0; ri < maxLeftR; ri++)
            {
                string rStr = "R" + (ri + 1).ToString();
                if (Structure.Checked)
                {
                    mc = mt.AddMetaColumn(rStr + "Str", rStr, MetaColumnType.Structure, ColumnSelectionEnum.Selected, 12);
                    if (ri == 0 && ShowCoreStructure.Checked)                     // include core structure above R1 if requested
                    {
                        string chimeString = MoleculeMx.MolfileStringToSmilesString(SQuery.MolfileString);
                        mc.Label = "R1, Core\tChime=" + chimeString;
                        mc.Width = 25;
                    }
                }
                if (Smiles.Checked)
                {
                    mc = mt.AddMetaColumn(rStr + "Smi", rStr + " Smiles", MetaColumnType.String, ColumnSelectionEnum.Selected, 12);
                }
                if (Formula.Checked)
                {
                    mc = mt.AddMetaColumn(rStr + "Mf", rStr + " Formula", MetaColumnType.String, ColumnSelectionEnum.Selected, 8);
                }
                if (Weight.Checked)
                {
                    mc = mt.AddMetaColumn(rStr + "MW", rStr + " Mol. Wt.", MetaColumnType.Number, ColumnSelectionEnum.Selected, 6, ColumnFormatEnum.Decimal, 2);
                }

                if (Index.Checked)
                {
                    mc        = mt.AddMetaColumn(rStr + "Index", rStr + " Subst. Idx.", MetaColumnType.Number, ColumnSelectionEnum.Selected, 4);
                    mc.Format = ColumnFormatEnum.Decimal;
                }
            }

            mc =             // add column to contain result type
                 mt.AddMetaColumn("ResultType", "Result Type", MetaColumnType.String, ColumnSelectionEnum.Selected, 12);

            if (oneD)             // add just 1 column to contain results
            {
                mc = mt.AddMetaColumn("Results", "Results", MetaColumnType.QualifiedNo, ColumnSelectionEnum.Selected, 12);
                mc.MetaBrokerType = MetaBrokerType.RgroupDecomp;                 // broker to do special col handling for cond formtting
                if (QbUtil.Query.UserObject.Id > 0)
                {
                    mc.DetailsAvailable = true;
                }
            }

            else             // add col for each substituent for last rgroup
            {
                string rStr = "R" + rgCount.ToString();
                for (si = 0; si < rSubs[rgCount - 1].Count; si++)
                {
                    string            cName  = rStr + "_" + (si + 1).ToString();
                    string            cLabel = cName.Replace("_", ".");
                    RgroupSubstituent rgs    = rSubs[ri][si];  // get substituent info
                    if (Structure.Checked)                     // include structure
                    {
                        cLabel += "\tChime=" + rgs.Struct.GetChimeString();
                    }

                    else if (Smiles.Checked)
                    {
                        cLabel += " = " + rgs.Struct.GetSmilesString();
                    }

                    else if (Formula.Checked)
                    {
                        cLabel += " = " + rgs.Struct.MolFormula;
                    }

                    else if (Weight.Checked)
                    {
                        cLabel += " = " + rgs.Struct.MolWeight;
                    }

                    else if (Index.Checked)
                    {
                        cLabel += " = " + (si + 1).ToString();
                    }

                    mc = mt.AddMetaColumn(cName, cLabel, MetaColumnType.QualifiedNo, ColumnSelectionEnum.Selected, 12);
                    mc.MetaBrokerType = MetaBrokerType.RgroupDecomp;
                    if (QbUtil.Query.UserObject.Id > 0)
                    {
                        mc.DetailsAvailable = true;
                    }
                }
            }

            MetaTableCollection.UpdateGlobally(mt); // add as a known metatable

            if (mElem.Count == 0)                   // be sure we have a matrix
            {
                Progress.Hide();
                MessageBoxMx.ShowError("No matrix can be created because insufficient data was found.");
                return(DialogResult.None);
            }

            // Build the DataTable

            Progress.Show("Building data table...");

            q2  = new Query();            // build single-table query to hold matrix
            qt2 = new QueryTable(q2, mt);
            dt  = DataTableManager.BuildDataTable(q2);

            Dictionary <string, List <QualifiedNumber> > .KeyCollection kc = mElem.Keys;
            string[] rgKeys = new string[mElem.Count];
            kc.CopyTo(rgKeys, 0);
            Array.Sort(rgKeys);

            string[] rgKey = null, lastRgKey = null;
            int      rki   = 0;

            for (rki = 0; rki < rgKeys.Length; rki++)
            {
                rgKey = rgKeys[rki].Split('\t');

                int riTop = rgCount + 1;                 // all r substituents & field name on left
                if (twoD)
                {
                    riTop = rgCount;
                }

                for (ri = 0; ri < riTop; ri++)                 // see if any changes in left side substituents or field name
                {
                    if (lastRgKey == null || rgKey[ri] != lastRgKey[ri])
                    {
                        break;
                    }
                }
                if (ri < riTop || oneD)                 // if 2d then new row only if some change before last R
                {
                    dr = dt.NewRow();
                    dt.Rows.Add(dr);
                    dr[dtm.KeyValueVoPos + 1] = new NumberMx(dt.Rows.Count);                     // integer row key
                }

                if (!HideRepeatingSubstituents.Checked)
                {
                    ri = 0;                                                     // start at first if not hiding
                }
                lastRgKey = rgKey;

                for (ri = ri; ri < riTop; ri++)                 // build row with these
                {
                    string rgSub = rgKey[ri];                   // get substituent id or table.column name
                    if (rgSub == "")
                    {
                        continue;
                    }

                    if (ri < riTop - 1)
                    {                     // output substituent and/or smiles
                        string rStr = "R" + (ri + 1).ToString();
                        si = rgSub.IndexOf("_");
                        si = Int32.Parse(rgSub.Substring(si + 1)) - 1;                 // get substituent index
                        RgroupSubstituent rgs = rSubs[ri][si];                         // get substituent info

                        if (Structure.Checked)
                        {
                            qc2 = qt2.GetQueryColumnByName(rStr + "Str");
                            dr[QcToDcName(qc2)] = rgs.Struct;
                        }

                        if (Smiles.Checked)
                        {
                            qc2 = qt2.GetQueryColumnByName(rStr + "Smi");
                            dr[QcToDcName(qc2)] = new StringMx(rgs.Struct.GetSmilesString());
                        }

                        if (Formula.Checked)
                        {
                            qc2 = qt2.GetQueryColumnByName(rStr + "Mf");
                            dr[QcToDcName(qc2)] = new StringMx(rgs.Struct.MolFormula);
                        }

                        if (Weight.Checked)
                        {
                            qc2 = qt2.GetQueryColumnByName(rStr + "Mw");
                            dr[QcToDcName(qc2)] = new NumberMx(rgs.Struct.MolWeight);
                        }

                        if (Index.Checked)
                        {
                            qc2 = qt2.GetQueryColumnByName(rStr + "Index");
                            dr[QcToDcName(qc2)] = new NumberMx(si + 1);
                        }
                    }

                    else                                // output field name
                    {
                        string[] sa = rgSub.Split('.'); // get field name
                        qt = q.GetQueryTableByName(sa[0]);
                        qc = qt.GetQueryColumnByName(sa[1]);
                        string fieldName = qc.ActiveLabel;
                        if (q0.Tables.Count >= 3)                         // qualify by table if 3 or more tables in original query
                        {
                            fieldName = qt.ActiveLabel + " - " + fieldName;
                        }

                        qc2 = qt2.GetQueryColumnByName("ResultType");
                        dr[QcToDcName(qc2)] = new StringMx(fieldName);
                    }
                }

                // Output value

                string cName;
                if (oneD)
                {
                    cName = "Results";
                }
                else
                {
                    cName = rgKey[rgCount];                  // get key for this substituent (e.g. R2_1)
                }
                if (Lex.IsUndefined(cName))
                {
                    continue;                                         // may be no substituent match
                }
                qc2 = qt2.GetQueryColumnByName(cName);
                QualifiedNumber qn = SummarizeData(mElem[rgKeys[rki]]);                 // get summarized value
                dr[QcToDcName(qc2)] = qn;
            }

            ToolHelper.DisplayData(q2, dt, true);

            UsageDao.LogEvent("RgroupMatrix");
            Progress.Hide();
            return(DialogResult.OK);
        }
 protected override void OnAwake()
 {
     base.OnAwake();
     DataTableManager = new DataTableManager();
 }
 private void LoadWeapons(string source)
 {
     WeaponDataTable = DataTableManager.LoadDataTable(source, true);
 }
 private void LoadEquipment(string source)
 {
     EquipmentDataTable = DataTableManager.LoadDataTable(source, false);
 }
示例#18
0
 private void LoadList2(Tuple <string, string, string> source)
 {
     ItemDataTable2 = IsWeaponSelected ? DataTableManager.LoadDataTable(source.Item2, true) : DataTableManager.LoadDataTable(source.Item3, false);
 }
示例#19
0
    private IEnumerator DoInitialzie()
    {
        LoadingQueue loadQueue         = new LoadingQueue(this);
        LoadObject   loadedCutSceneObj = loadQueue.Load(RESOURCE_CATEGORY.CUTSCENE, "Opening", false);
        LoadObject   loadedTitleObj    = loadQueue.Load(RESOURCE_CATEGORY.CUTSCENE, "Title", false);

        int[] se_ids = (int[])Enum.GetValues(typeof(AUDIO));
        int[] array  = se_ids;
        foreach (int id in array)
        {
            loadQueue.CacheSE(id, null);
        }
        int[] voices = (int[])Enum.GetValues(typeof(VOICE));
        int[] array2 = voices;
        foreach (int id2 in array2)
        {
            loadQueue.CacheVoice(id2, null);
        }
        if (loadQueue.IsLoading())
        {
            yield return((object)loadQueue.Wait());
        }
        if (MonoBehaviourSingleton <AppMain> .I.mainCamera != null)
        {
            MonoBehaviourSingleton <AppMain> .I.mainCamera.set_enabled(false);
        }
        cutSceneObjectRoot = (ResourceUtility.Instantiate <Object>(loadedCutSceneObj.loadedObject) as GameObject);
        cutSceneObjectRoot.get_transform().set_parent(MonoBehaviourSingleton <AppMain> .I.get_transform());
        titleObjectRoot = (ResourceUtility.Instantiate <Object>(loadedTitleObj.loadedObject) as GameObject);
        titleObjectRoot.get_transform().set_parent(MonoBehaviourSingleton <AppMain> .I.get_transform());
        Transform eventObj = cutSceneObjectRoot.get_transform().FindChild("CUT_op");

        if (eventObj != null)
        {
            cutOP             = eventObj.get_gameObject();
            cutSceneAnimation = cutOP.GetComponent <Animation>();
            cutOP.SetActive(false);
        }
        Transform fade = cutSceneObjectRoot.get_transform().FindChild("Main Camera/Plane");

        if (fade != null)
        {
            MeshRenderer renderer = fade.GetComponent <MeshRenderer>();
            whiteFadeMaterial = renderer.get_material();
        }
        titleAnimation = titleObjectRoot.GetComponent <Animation>();
        cutSceneAnimation.Stop();
        MonoBehaviourSingleton <FieldManager> .I.SetCurrentFieldMapPortalID(10000100u);

        MonoBehaviourSingleton <GoWrapManager> .I.trackTutorialStep(TRACK_TUTORIAL_STEP_BIT.tutorial_start_screen, "Tutorial");

        MonoBehaviourSingleton <UIManager> .I.loading.HideAllPermissionMsg();

        base.Initialize();
        PredownloadManager.openingMode = true;
        MonoBehaviourSingleton <AppMain> .I.get_gameObject().AddComponent <PredownloadManager>();

        MonoBehaviourSingleton <UIManager> .I.loading.downloadGaugeVisible = false;
        PredownloadManager.Stop(PredownloadManager.STOP_FLAG.INGAME_TUTORIAL, true);
        DataTableManager dataTableManager = MonoBehaviourSingleton <DataTableManager> .I;

        Protocol.Send <CheckRegisterModel>(CheckRegisterModel.URL, delegate
        {
            ((_003CDoInitialzie_003Ec__IteratorEC) /*Error near IL_0399: stateMachine*/)._003CupdatedTableIndex_003E__15 = true;
        }, string.Empty);
        yield return((object)new WaitUntil((Func <bool>)(() => ((_003CDoInitialzie_003Ec__IteratorEC) /*Error near IL_03b0: stateMachine*/)._003CupdatedTableIndex_003E__15)));

        isDownloading = true;
        dataTableManager.InitializeForDownload();
        dataTableManager.UpdateManifest(delegate
        {
            ((_003CDoInitialzie_003Ec__IteratorEC) /*Error near IL_03ef: stateMachine*/)._003CdataTableManager_003E__14.LoadInitialTable(delegate
            {
                List <DataLoadRequest> loadings = ((_003CDoInitialzie_003Ec__IteratorEC) /*Error near IL_03ef: stateMachine*/)._003CdataTableManager_003E__14.LoadAllTable(delegate
                {
                    PredownloadManager.Stop(PredownloadManager.STOP_FLAG.INGAME_TUTORIAL, false);
                    ((_003CDoInitialzie_003Ec__IteratorEC) /*Error near IL_03ef: stateMachine*/)._003C_003Ef__this.isDownloading = false;
                }, true);
                MonoBehaviourSingleton <UIManager> .I.loading.SetProgress(new FirstOpeningProgress(loadings));
            }, true);
        });
        TitleTop.isFirstBoot = false;
    }