Exemplo n.º 1
0
        public List <string> UnzipFiles(string path)
        {
            var tempFolderName = _sandBox.GetNewTempFolderName();

            ClientDataLoader.UnzipClientData(path, tempFolderName);
            return(Directory.GetFiles(Path.Combine(tempFolderName, "15-UFOP")).ToList());
        }
Exemplo n.º 2
0
        public string DownloadFile(Uri url)
        {
            var tempFileName = _sandBox.GetNewTempFileName();

            ClientDataLoader.LoadFromExternalStore(url, tempFileName);
            return(tempFileName);
        }
Exemplo n.º 3
0
    public static DataHolder <T> Create(string fileName, Func <T, string> idGetter)
    {
        var data   = ClientDataLoader.Load <T>(fileName);
        var holder = Create(data, idGetter);;

        holder.Filename = fileName;
        return(holder);
    }
        private void PhaseTwoLoad()
        {
            // load the data store with the downloaded data ?
            ClientDataLoader ccDataLoad = new ClientDataLoader();

            ccDataLoad.OnDataLoadComplete += errors => { PhaseThreeLoad(); };
            ccDataLoad.PopulateDataStore();
        }
Exemplo n.º 5
0
    public static DataHolder <T> Create(string fileName, Func <T, string> idGetter)
    {
        UnityEngine.Debug.Log($"filename {fileName}");

        var data   = ClientDataLoader.Load <T>(fileName);
        var holder = Create(data, idGetter);;

        holder.Filename = fileName;
        return(holder);
    }
    void init()
    {
        string source = (Resources.Load(ClientDataLoader.CLIENT_DATA_PATH + "data_hardcodingtext_client") as TextAsset).ToString();
        Dictionary <string, object> jd = MiniJSON.Json.Deserialize(source) as Dictionary <string, object>;
        Dictionary <string, int>    k  = ClientDataLoader.getKeyIndexDic((List <object>)jd[ClientDataLoader.NAME]);

        foreach (KeyValuePair <string, object> kv in jd)
        {
            if (kv.Key != ClientDataLoader.NAME)
            {
                List <object> list = kv.Value as List <object>;
                TextData      td   = new TextData();
                td.setData(list, k);
                data[(string)list[k["ID"]]] = td;
                list = null;
            }
        }

        jd.Clear();
        jd = null;

        k.Clear();
        k = null;
    }
Exemplo n.º 7
0
    void setIntroText()
    {
        string source = (Resources.Load(ClientDataLoader.CLIENT_DATA_PATH + "data_introtext_client") as TextAsset).ToString();

        List <IntroTextData> normal = new List <IntroTextData>();
        List <IntroTextData> days   = new List <IntroTextData>();
        List <IntroTextData> dates  = new List <IntroTextData>();
        List <IntroTextData> times  = new List <IntroTextData>();

        Dictionary <string, object> jd = MiniJSON.Json.Deserialize(source) as Dictionary <string, object>;
        Dictionary <string, int>    k  = ClientDataLoader.getKeyIndexDic((List <object>)jd[ClientDataLoader.NAME]);

        // -- 여기까지.

        foreach (KeyValuePair <string, object> kv in jd)
        {
            if (kv.Key != ClientDataLoader.NAME)
            {
                List <object> list = kv.Value as List <object>;
                IntroTextData data = new IntroTextData();
                data.setData(list, k);

                switch (data.type)
                {
                case IntroTextData.Type.Date:
                    dates.Add(data);
                    break;

                case IntroTextData.Type.Day:
                    days.Add(data);
                    break;

                case IntroTextData.Type.Time:
                    times.Add(data);
                    break;

                default:
                    normal.Add(data);
                    break;
                }

                list = null;
            }
        }

        jd.Clear();
        jd = null;

        k.Clear();
        k = null;

        DateTime now = System.DateTime.Now;

        DateTime checkTime = System.DateTime.Today;

        DateTime start = new DateTime();;
        DateTime end   = new DateTime();

        for (int i = times.Count - 1; i >= 0; --i)
        {
            if (times[i].startHour == 24)
            {
                times[i].startHour = 0;
            }
            if (times[i].endHour == 24)
            {
                times[i].endHour = 0;
            }

            if (times[i].startHour <= times[i].endHour)
            {
                start = ChangeTime(checkTime, times[i].startHour, times[i].startMin);
                end   = ChangeTime(checkTime, times[i].endHour, times[i].endMin);
            }
            else if (times[i].startHour > times[i].endHour)
            {
                start = ChangeTime(checkTime, times[i].startHour, times[i].startMin);
                end   = ChangeTime(checkTime.AddDays(1), times[i].endHour, times[i].endMin);
            }

            if (now >= start && now <= end)
            {
                normal.Add(times[i]);
            }
        }

        for (int i = days.Count - 1; i >= 0; --i)
        {
            foreach (int d in days[i].day)
            {
                if (d == (int)now.DayOfWeek)
                {
                    normal.Add(days[i]);
                }
            }
        }


        for (int i = dates.Count - 1; i >= 0; --i)
        {
            if (dates[i].startMonth <= dates[i].endMonth)
            {
                start = ChangeDate(checkTime, dates[i].startMonth, dates[i].startDay);
                end   = ChangeDate(checkTime, dates[i].endMonth, dates[i].endDay);
            }
            else if (dates[i].startMonth > dates[i].endMonth)
            {
                start = ChangeDate(checkTime, dates[i].startMonth, dates[i].startDay);
                end   = ChangeDate(checkTime.AddYears(1), dates[i].endMonth, dates[i].endDay);
            }

            if (now >= start && now <= end)
            {
                normal.Add(dates[i]);
            }
        }

        if (normal.Count > 0)
        {
            normal.Sort(IntroTextData.sort);

            int totalWeight = 0;

            for (int i = normal.Count - 1; i >= 0; --i)
            {
                totalWeight += normal[i].weight;
            }

            int randomValue = UnityEngine.Random.Range(0, totalWeight);

            totalWeight = 0;

            for (int i = normal.Count - 1; i >= 0; --i)
            {
                totalWeight += normal[i].weight;

                if (totalWeight > randomValue)
                {
                    lbText.text = normal[i].text;
                    return;
                }
            }


            lbText.text = normal[0].text;

            return;
        }


        lbText.text = "지금은 소울 타임! 모험할 준비는 되셨나요?";
    }