Ejemplo n.º 1
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads, inserts and create reports for each register in the file
        /// </summary>
        /// <param name="filePath"> file you wnat to read </param>
        public static void ReadFile(string filePath, List <bool> checkList)
        {
            int count = 1;

            try
            {
                foreach (string line in File.ReadLines(filePath, Encoding.UTF8))
                {
                    try
                    {
                        if (count != 1)
                        {
                            try
                            {
                                User     currentUser          = LineToModel(line);
                                DateTime currentUserBirthdate = currentUser.BirthDate.Value;
                                if (checkList[0])
                                {
                                    Thread thread1 = new Thread(() => InsertDB.Excecute(currentUser));
                                    thread1.Start();
                                }
                                if (checkList[1])
                                {
                                    Thread thread2 = new Thread(() => ReportLibrary.Report.GenerateReport(writePath + currentUser.Id + ".csv", currentUser.GetUserInfo()));
                                    thread2.Start();
                                }
                                if (checkList[2])
                                {
                                    Thread thread3 = new Thread(() => Log.ShowInformationMessage("User: (id:" + currentUser.Id + ",age:" + DateUtils.CalculateAge(currentUserBirthdate) + ")"));
                                    thread3.Start();
                                }
                            }
                            catch (Exception processException)
                            {
                                Log.ShowErrorMessage("Error excecuting the processes: " + processException.ToString());
                            }
                        }
                    }
                    catch
                    {
                        Log.ShowErrorMessage("Error reading line: " + count);
                    }
                    count++;
                }
            }
            catch
            {
                Log.ShowErrorMessage("Can´t read correctly the file: " + filePath);
            }
        }
Ejemplo n.º 3
0
 static void Main(string[] args)
 {
     InsertDB.DBInsert();
 }
Ejemplo n.º 4
0
 void Awake()
 {
     if (_instance == null)
         _instance = this;
 }
Ejemplo n.º 5
0
    public void planetChange(Vector3 spawnPoint)
    {
        int    rand         = GameObject.Find("PlanetManager").gameObject.GetComponent <RandPlanet>().PlanetCreate();
        float  tempDistance = 500;      // 별자리 거리 임시 값
        int    nearStar     = 0;        // 가장 가까운 별자리 카운트 값
        string tempName;
        int    tempsize;
        int    tempcolor;
        int    tempmFood;
        int    tempmTitanium;
        int    tempLepersec;
        float  tempX;
        float  tempY;
        float  tempZ;
        int    tempmat;

        // 행성 오브젝트 생성 및 배치
        GameObject obj = Instantiate(GameObject.Find("PlanetManager").gameObject.GetComponent <RandPlanet>().D_PlanetList[rand]);

        obj.transform.position = spawnPoint;

        // 행성 이름 생성 <형용사(사이즈별)> + <행성 색깔> + <별자리이름> 조합
        // 가까운 별자리 찾기
        for (int i = 1; i <= 12; i++)
        {
            string starName     = "Center_" + i;
            float  starDistance = Vector3.Distance(obj.transform.position, GameObject.Find(starName).transform.position);

            Debug.Log(starName + "\t" + starDistance);
            if (tempDistance > starDistance)
            {
                tempDistance = starDistance;
                nearStar     = i;
            }
        }
        Debug.Log("제일 가까운 거리!" + tempDistance + "\t" + nearStar);
        tempName = GameObject.Find("PlanetManager").gameObject.GetComponent <RandPlanet>().PlanetNameCreate() + " " + GameObject.Find("PlanetManager").gameObject.GetComponent <RandPlanet>().zName[nearStar - 1];
        obj.name = tempName;

        tempsize      = GameObject.Find("PlanetManager").gameObject.GetComponent <RandPlanet>().sizeT;
        tempcolor     = GameObject.Find("PlanetManager").gameObject.GetComponent <RandPlanet>().colorT;
        tempmFood     = UnityEngine.Random.Range(tempsize * tempsize * 100, tempsize * 5 * 100) + 1500;
        tempmTitanium = UnityEngine.Random.Range(tempsize * tempsize * 100, tempsize * 5 * 100) + 2500;
        tempLepersec  = tempsize;
        tempX         = spawnPoint.x;
        tempY         = spawnPoint.y;
        tempZ         = spawnPoint.z;
        tempmat       = GameObject.Find("PlanetManager").gameObject.GetComponent <RandPlanet>().matT;

        UpdateDB.Instance().table     = "managePlanetTable";
        UpdateDB.Instance().setColumn = " \"User\" = 0 ";
        UpdateDB.Instance().where = " WHERE \"User\"= 1";
        UpdateDB.Instance().UpdateData();

        //초기 행성생성시 데이터 초기화 및 DB INSERT (Table Column 순서 수정필요함)
        InsertDB.Instance().table  = "managePlanetTable";
        InsertDB.Instance().column = "name,size,color,mFood,mTitanium,le_persec,locationX,locationY,locationZ,mat,lFood,lTitanium,User";
        InsertDB.Instance().values = "\"" + tempName + "\"," +  //name      행성이름
                                     tempsize + "," +           //size      행성크기
                                     tempcolor + "," +          //color     행성색상
                                     tempmFood + "," +          //mFood     식량 부존량
                                     tempmTitanium + "," +      //mTitanium 티타늄 부존량
                                     tempLepersec + "," +       //le_persec 초당 빛생산량
                                     tempX + "," +              //locationX 좌표X
                                     tempY + "," +              //locationY 좌표Y
                                     tempZ + "," +              //locationZ 좌표Z
                                     tempmat + "," +            //material  행성 스타일
                                     tempmFood + "," +          //lFood     식량 잔존량
                                     tempmTitanium + "," +      //lTitanium 티타늄 잔존량
                                     "1";
        InsertDB.Instance().Insert();
        SoundManager.Instance().bgmType = 1;
        GameObject.Find("Nav").gameObject.GetComponent <StarNavigation>().spentFuel();  //연료 소모 DB반영
        GameObject.Find("GameManager").gameObject.GetComponent <ButtonController>().TransSceneToPlanet();
    }