コード例 #1
0
ファイル: UIPackageModel.cs プロジェクト: tudou167/AAA
    public List <EquipmentTemp.Row.Row2> Sort(List <EquipmentTemp.Row.Row2> data, int sortType)
    {
        switch (sortType)
        {
        case 0:
            data = SortFunc(data, SortByID);
            break;

        case 1:
            data = SortFunc(data, SortByQuality);
            break;

        case 2:
            data = SortFunc(data, SortByItemType);
            break;

        case 3:
            data = SortFunc(data, SortBySellPrice);
            Debug.Log("改");
            break;
        }

        EquipmentTemp lastData = AllToObject.Instance.GetAllUserPackge <EquipmentTemp>();

        lastData.User[userID].Data = data;
        SaveAllUserData(lastData);
        return(data);
    }
コード例 #2
0
ファイル: UIPackageModel.cs プロジェクト: tudou167/AAA
    public void InItem(EquipmentTemp.Row.Row2 data, int count = 1)
    {
        EquipmentTemp UserPackageData = AllToObject.Instance.GetAllUserPackge <EquipmentTemp>();

        EquipmentTemp.Row packData = UserPackageData.User[userID];
        for (int i = 0; i < packData.Data.Count; i++)
        {
            if (packData.Data[i].eid == data.id && (int)data.itemType >= 8)
            {
                packData.Data[i].count += count;
                SaveAllUserData(UserPackageData);
                return;
            }
        }


        data.count = count;
        data.eid   = data.id;
        if (UserPackageData.User[userID].Data.Count == 0)
        {
            data.id = 1;
        }
        else
        {
            data.id = UserPackageData.User[userID].Data[UserPackageData.User[userID].Data.Count - 1].id + 1;
        }
        data.InitialLevel = 1;

        UserPackageData.User[userID].Data.Add(data);
        SaveAllUserData(UserPackageData);
    }
コード例 #3
0
ファイル: UIPackageModel.cs プロジェクト: tudou167/AAA
    public List <EquipmentTemp.Row.Row2> LoadUserPackageData()
    {
        if (File.Exists(AllPaths.Instance.userPackagePath))
        {
            EquipmentTemp UserPackageData = AllToObject.Instance.GetAllUserPackge <EquipmentTemp>();

            return(UserPackageData.User[userID].Data);
        }
        return(null);
    }
コード例 #4
0
        public void add(EquipmentTemp eqTem)
        {
            int max = eqTemUtils.loads().Count;

            eqTem.Count = max + 1;
            eqTemUtils.add(eqTem.ItemNo,
                           eqTem.ComName,
                           eqTem.Plant,
                           eqTem.OperingPressInlet,
                           eqTem.OperTempInlet,
                           eqTem.OperingPressOutlet,
                           eqTem.OperTempOutlet,
                           eqTem.TestPress,
                           eqTem.MDMT,
                           eqTem.InService,
                           eqTem.ServiceDate,
                           eqTem.LastInternalInspectionDate,
                           eqTem.LDTBXHCovered,
                           eqTem.Insulated,
                           eqTem.PWHT,
                           eqTem.InsulatedType,
                           eqTem.OperatingState,
                           eqTem.InventoryLiquip,
                           eqTem.InventoryVapor,
                           eqTem.InventoryTotal,
                           eqTem.ConfidentInStreamAnalysis,
                           eqTem.VaporDensityAir,
                           eqTem.CorrosionInhibitor,
                           eqTem.FrequentFeedChanged,
                           eqTem.MajorChemicals,
                           eqTem.Contaminants,
                           eqTem.OnLineMonitoring,
                           eqTem.CathodicProtection,
                           eqTem.CorrosionMonitoring,
                           eqTem.OHCalibUptodate,
                           eqTem.DistFromFacility,
                           eqTem.EquipCount,
                           eqTem.HAZOPRating,
                           eqTem.PersonalDensity,
                           eqTem.MitigationEquip,
                           eqTem.EnvRating,
                           eqTem.InspTechUsed,
                           eqTem.EquipModification,
                           eqTem.InspectionFinding,
                           eqTem.VaporDensity,
                           eqTem.LiquipDensity,
                           eqTem.Vapor,
                           eqTem.Liquip,
                           eqTem.HMBPFDNum,
                           eqTem.PIDNum,
                           eqTem.Service,
                           eqTem.HMBStream,
                           eqTem.Count);
        }
コード例 #5
0
ファイル: UIPackageModel.cs プロジェクト: tudou167/AAA
    public EquipmentTemp.Row.Row2 Intensify(EquipmentTemp.Row.Row2 data)
    {
        int need = data.InitialLevel;

        if (need >= 5)
        {
            need = 5;
        }
        EquipmentTemp UserPackageData             = AllToObject.Instance.GetAllUserPackge <EquipmentTemp>();
        List <EquipmentTemp.Row.Row2> userPackage = UserPackageData.User[userID].Data;

        for (int i = 0; i < userPackage.Count; i++)
        {
            if ((int)userPackage[i].itemType == 8 && userPackage[i].quality == data.quality && userPackage[i].count >= need)
            {
                userPackage[i].count -= need;
                if (userPackage[i].count == 0)
                {
                    userPackage.Remove(userPackage[i]);
                }
                for (int j = 0; j < userPackage.Count; j++)
                {
                    if (userPackage[j].id == data.id)
                    {
                        userPackage[j].InitialLevel += 1;
                        int tempLv = userPackage[j].InitialLevel;
                        int atk    = AllFormula.Instance.GetEquipProperty(userPackage[j].atk, tempLv);
                        int def    = AllFormula.Instance.GetEquipProperty(userPackage[j].def, tempLv);
                        int crit   = AllFormula.Instance.GetEquipProperty(userPackage[j].crit, tempLv);
                        int hp     = AllFormula.Instance.GetEquipProperty(userPackage[j].hp, tempLv);
                        userPackage[j].atk  = atk;
                        userPackage[j].def  = def;
                        userPackage[j].crit = crit;
                        userPackage[j].hp   = hp;
                        data.InitialLevel  += 1;
                        data.atk            = atk;
                        data.def            = def;
                        data.crit           = crit;
                        data.hp             = hp;
                    }
                }
            }
        }

        UserPackageData.User[userID].Data = userPackage;

        SaveAllUserData(UserPackageData);
        return(data);
    }
コード例 #6
0
ファイル: UIPackageModel.cs プロジェクト: tudou167/AAA
    public List <EquipmentTemp.Row.Row2> Sell(EquipmentTemp.Row.Row2 data, int count = 1)
    {
        List <EquipmentTemp.Row.Row2> getInfo = null;
        EquipmentTemp UserPackageData         = AllToObject.Instance.GetAllUserPackge <EquipmentTemp>();

        for (int i = 0; i < UserPackageData.User[userID].Data.Count; i++)
        {
            if (UserPackageData.User[userID].Data[i].eid == data.eid)
            {
                PlayerModel.Instance.AddGold(AllFormula.Instance.SellPrice(UserPackageData.User[userID].Data[i].buy, UserPackageData.User[userID].Data[i].InitialLevel, count));

                if (UserPackageData.User[userID].Data[i].count == count)
                {
                    EquipmentTemp.Row.Row2 temp1 = UserPackageData.User[userID].Data[i];
                    UserPackageData.User[userID].Data.Remove(temp1);
                    if ((int)temp1.itemType < 8 && temp1.isWear == 1)
                    {
                        CharacterInfo userData = PlayerModel.Instance._characterInfo;
                        userData.atk   -= temp1.atk;
                        userData.def   -= temp1.def;
                        userData.crit  -= temp1.crit;
                        userData.maxHp -= temp1.hp;
                        if (userData.hp >= userData.maxHp)
                        {
                            userData.hp = userData.maxHp;
                        }
                        else
                        {
                            userData.hp -= temp1.hp;
                        }
                        PlayerModel.Instance.SaveCharacterInfo(userData);
                    }
                }
                else
                {
                    UserPackageData.User[userID].Data[i].count -= count;
                }
                getInfo = UserPackageData.User[userID].Data;
            }
        }
        SaveAllUserData(UserPackageData);
        return(getInfo);
    }
コード例 #7
0
ファイル: UIPackageModel.cs プロジェクト: tudou167/AAA
    public EquipmentTemp.Row.Row2 WearEquip(EquipmentTemp.Row.Row2 data)
    {
        EquipmentTemp UserPackageData = AllToObject.Instance.GetAllUserPackge <EquipmentTemp>();

        EquipmentTemp.Row.Row2 original = null;
        for (int i = 0; i < UserPackageData.User[userID].Data.Count; i++)
        {
            if (UserPackageData.User[userID].Data[i].itemType == data.itemType && UserPackageData.User[userID].Data[i].isWear == 1)
            {
                UserPackageData.User[userID].Data[i].isWear = 0;
                original = UserPackageData.User[userID].Data[i];
            }

            if (UserPackageData.User[userID].Data[i].id == data.id)
            {
                UserPackageData.User[userID].Data[i].isWear = 1;
            }
        }
        SaveAllUserData(UserPackageData);
        return(original);
    }
コード例 #8
0
ファイル: UIPackageModel.cs プロジェクト: tudou167/AAA
    public void NewPackage()
    {
        if (!File.Exists(AllPaths.Instance.fileUserPackageStaticPath))
        {
            Debug.LogError("没有用户背包生成表");
            return;
        }

        string        staticUserPackage = AllJson.Instance.userPackageStaticJson();
        EquipmentTemp UserPackageData   = AllToObject.Instance.GetAllUserPackge <EquipmentTemp>();
        List <EquipmentTemp.Row.Row2> newPackageInit = JsonMapper.ToObject <List <EquipmentTemp.Row.Row2> >(staticUserPackage);

        EquipmentTemp.Row row = new EquipmentTemp.Row();
        row.Data = new List <EquipmentTemp.Row.Row2>();
        for (int i = 0; i < newPackageInit.Count; i++)
        {
            row.Data.Add(newPackageInit[i]);
        }
        UserPackageData.User.Add(row);

        SaveAllUserData(UserPackageData);
    }
コード例 #9
0
        public List <EquipmentTemp> loads()
        {
            List <EquipmentTemp> listEq = new List <EquipmentTemp>();
            MySqlConnection      conn   = DBUtils.getDBConnection();

            conn.Open();
            String sql = "SELECT * FROM tbl_equipmenttemp";

            try
            {
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            eqTemp                            = new EquipmentTemp();
                            eqTemp.Count                      = int.Parse(reader.GetString(0));
                            eqTemp.Plant                      = reader.GetString(1);
                            eqTemp.OperingPressInlet          = reader.GetString(2);
                            eqTemp.OperTempInlet              = reader.GetString(3);
                            eqTemp.OperingPressOutlet         = reader.GetString(4);
                            eqTemp.OperTempOutlet             = reader.GetString(5);
                            eqTemp.TestPress                  = reader.GetString(6);
                            eqTemp.MDMT                       = reader.GetString(7);
                            eqTemp.InService                  = reader.GetString(8);
                            eqTemp.ServiceDate                = reader.GetString(9);
                            eqTemp.LastInternalInspectionDate = reader.GetString(10);
                            eqTemp.LDTBXHCovered              = reader.GetString(11);
                            eqTemp.Insulated                  = reader.GetString(12);
                            eqTemp.PWHT                       = reader.GetString(13);
                            eqTemp.InsulatedType              = reader.GetString(14);
                            eqTemp.OperatingState             = reader.GetString(15);
                            eqTemp.InventoryLiquip            = reader.GetString(16);
                            eqTemp.InventoryVapor             = reader.GetString(17);
                            eqTemp.InventoryTotal             = reader.GetString(18);
                            eqTemp.ConfidentInStreamAnalysis  = reader.GetString(19);
                            eqTemp.VaporDensityAir            = reader.GetString(20);
                            eqTemp.CorrosionInhibitor         = reader.GetString(21);
                            eqTemp.FrequentFeedChanged        = reader.GetString(22);
                            eqTemp.MajorChemicals             = reader.GetString(23);
                            eqTemp.Contaminants               = reader.GetString(24);
                            eqTemp.OnLineMonitoring           = reader.GetString(25);
                            eqTemp.CathodicProtection         = reader.GetString(26);
                            eqTemp.CorrosionMonitoring        = reader.GetString(27);
                            eqTemp.OHCalibUptodate            = reader.GetString(28);
                            eqTemp.DistFromFacility           = reader.GetString(29);
                            eqTemp.EquipCount                 = reader.GetString(30);
                            eqTemp.HAZOPRating                = reader.GetString(31);
                            eqTemp.PersonalDensity            = reader.GetString(32);
                            eqTemp.MitigationEquip            = reader.GetString(33);
                            eqTemp.EnvRating                  = reader.GetString(34);
                            eqTemp.InspTechUsed               = reader.GetString(35);
                            eqTemp.EquipModification          = reader.GetString(36);
                            eqTemp.InspectionFinding          = reader.GetString(37);
                            eqTemp.VaporDensity               = reader.GetString(38);
                            eqTemp.LiquipDensity              = reader.GetString(39);
                            eqTemp.Vapor                      = reader.GetString(40);
                            eqTemp.Liquip                     = reader.GetString(41);
                            eqTemp.HMBPFDNum                  = reader.GetString(42);
                            eqTemp.PIDNum                     = reader.GetString(43);
                            eqTemp.Service                    = reader.GetString(44);
                            eqTemp.HMBStream                  = reader.GetString(45);
                            eqTemp.ItemNo                     = reader.GetString(46);
                            eqTemp.ComName                    = reader.GetString(47);

                            listEq.Add(eqTemp);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("Load data failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(listEq);
        }
コード例 #10
0
        public List <EquipmentTemp> getListEQTemp(String path)
        {
            List <EquipmentTemp> list = new List <EquipmentTemp>();
            OleDbConnection      conn = getConnect(path);

            try
            {
                conn.Open();
                String          cmd     = "select * from [Data$]";
                OleDbCommand    command = new OleDbCommand(cmd, conn);
                OleDbDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    if (!reader[2].ToString().Equals(""))
                    {
                        eq                            = new EquipmentTemp();
                        eq.Plant                      = reader[0].ToString();
                        eq.OperingPressInlet          = reader[15].ToString();
                        eq.OperTempInlet              = reader[16].ToString();
                        eq.OperingPressOutlet         = reader[17].ToString();
                        eq.OperTempOutlet             = reader[18].ToString();
                        eq.TestPress                  = reader[19].ToString();
                        eq.MDMT                       = reader[20].ToString();
                        eq.InService                  = reader[21].ToString();
                        eq.ServiceDate                = reader[22].ToString();
                        eq.LastInternalInspectionDate = reader[23].ToString();
                        eq.LDTBXHCovered              = reader[24].ToString();
                        eq.Insulated                  = reader[25].ToString();
                        eq.PWHT                       = reader[26].ToString();
                        eq.InsulatedType              = reader[27].ToString();
                        eq.OperatingState             = reader[28].ToString();
                        eq.InventoryLiquip            = reader[29].ToString();
                        eq.InventoryVapor             = reader[30].ToString();
                        eq.InventoryTotal             = reader[31].ToString();
                        eq.ConfidentInStreamAnalysis  = reader[32].ToString();
                        eq.VaporDensityAir            = reader[33].ToString();
                        eq.CorrosionInhibitor         = reader[34].ToString();
                        eq.FrequentFeedChanged        = reader[35].ToString();
                        eq.MajorChemicals             = reader[36].ToString();
                        eq.Contaminants               = reader[37].ToString();
                        eq.OnLineMonitoring           = reader[38].ToString();
                        eq.CathodicProtection         = reader[39].ToString();
                        eq.CorrosionMonitoring        = reader[40].ToString();
                        eq.OHCalibUptodate            = reader[41].ToString();
                        eq.DistFromFacility           = reader[42].ToString();
                        eq.EquipCount                 = reader[43].ToString();
                        eq.HAZOPRating                = reader[44].ToString();
                        eq.PersonalDensity            = reader[45].ToString();
                        eq.MitigationEquip            = reader[46].ToString();
                        eq.EnvRating                  = reader[47].ToString();
                        eq.InspTechUsed               = reader[48].ToString();
                        eq.EquipModification          = reader[49].ToString();
                        eq.InspectionFinding          = reader[50].ToString();
                        eq.VaporDensity               = reader[51].ToString();
                        eq.LiquipDensity              = reader[52].ToString();
                        eq.Vapor                      = reader[53].ToString();
                        eq.Liquip                     = reader[54].ToString();
                        eq.HMBPFDNum                  = reader[55].ToString();
                        eq.PIDNum                     = reader[56].ToString();
                        eq.Service                    = reader[57].ToString();
                        eq.HMBStream                  = reader[58].ToString();
                        eq.ItemNo                     = reader[2].ToString();
                        eq.ComName                    = reader[5].ToString();

                        list.Add(eq);
                    }
                }
            }
            catch
            {
                MessageBox.Show("Please Check Version Excel File Or Fomat", "Error rbi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(list);
        }
コード例 #11
0
ファイル: UIPackageModel.cs プロジェクト: tudou167/AAA
 public void SaveAllUserData(EquipmentTemp data)
 {
     File.WriteAllText(AllPaths.Instance.userPackagePath, JsonMapper.ToJson(data));
 }