Ejemplo n.º 1
0
        private void TrainerStyleCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            var index       = TrainerStyleCB.SelectedIndex;
            var puppetindex = TrainerPuppetCB.SelectedIndex;
            var slotindex   = TrainerSlotCB.SelectedIndex;
            var dodindex    = TrainerLB.SelectedIndex;

            if (index < 0 || puppetindex < 0 || slotindex < 0 || dodindex < 0)
            {
                return;
            }

            var      id = dods_[dodindex].puppets[slotindex].id;
            DollData data;

            if (puppetindex > 0 && puppets_.ContainsKey(id))
            {
                data = puppets_[id];
            }
            else
            {
                data = new DollData();
            }

            TrainerAbilityCB.SelectedIndex = -1;
            TrainerAbilityCB.Items.Clear();
            foreach (var ability in data.styles[index].abilities)
            {
                TrainerAbilityCB.Items.Add(ability_names_.ContainsKey(ability) ? ability_names_[ability] : "None");
            }

            dods_[dodindex].puppets[slotindex].style = (uint)index;
        }
Ejemplo n.º 2
0
        private void TrainerLevelSC_ValueChanged(object sender, EventArgs e)
        {
            var value       = TrainerLevelSC.Value;
            var puppetindex = TrainerPuppetCB.SelectedIndex;
            var slotindex   = TrainerSlotCB.SelectedIndex;
            var dodindex    = TrainerLB.SelectedIndex;

            if (puppetindex < 0 || slotindex < 0 || dodindex < 0)
            {
                return;
            }

            var      id   = ((Tuple <string, uint>)TrainerPuppetCB.SelectedItem).Item2;
            DollData data = puppets_.ContainsKey(id) ? puppets_[id] : new DollData();

            TrainerExpSC.Value = ExpForLevel(data.cost, (uint)value);
        }
Ejemplo n.º 3
0
    public void SetMiniBuff(DollData dolldata)
    {
        if (!go.activeSelf)
        {
            MiniBuffOn();
        }

        for (int i = 0; i < miniBfs.Length; i++)
        {
            SetNothing(i);
        }

        SetCenter(dolldata.effect.effectCenter - 1);

        for (int i = 0; i < dolldata.effect.effectPos.Length; i++)
        {
            SetBuff(dolldata.effect.effectPos[i] - 1);
        }
    }
Ejemplo n.º 4
0
        public override void RunAction()
        {
            ModStorage.dolls["dolldata0"] = Game.Instance.Player.MainCharacter.Value.Descriptor.Doll;
            ModStorage.dolls["dolldata1"] = Game.Instance.Player.MainCharacter.Value.Descriptor.Doll;
            if (ModStorage.dolls.ContainsKey(dollData_key))
            {
                DollData       doll   = ModStorage.dolls[dollData_key];
                UnitDescriptor unit   = unitEV.GetValue().Descriptor;
                UnitEntityView newViw = doll.CreateUnitView();
                UnitEntityView oldVIw = unit.Unit.View;
                newViw.UniqueId = unit.Unit.UniqueId;
                newViw.transform.SetParent(unit.Unit.View.transform);
                newViw.transform.SetPositionAndRotation(unit.Unit.View.transform.position, unit.Unit.View.transform.rotation);
                newViw.Blueprint = unit.Unit.Blueprint;
                newViw.UpdateBodyEquipmentModel();
                //newViw.UpdateViewActive();
                unit.Doll = doll;
                unit.Unit.AttachToViewOnLoad(newViw);


                //UnityEngine.Object.Destroy(oldVIw.gameObject);
            }
        }
Ejemplo n.º 5
0
        private void TrainerPuppetCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            var index     = TrainerPuppetCB.SelectedIndex;
            var slotindex = TrainerSlotCB.SelectedIndex;
            var dodindex  = TrainerLB.SelectedIndex;

            if (index < 0 || slotindex < 0 || dodindex < 0)
            {
                return;
            }

            var      id   = ((Tuple <string, uint>)TrainerPuppetCB.SelectedItem).Item2;
            DollData data = puppets_.ContainsKey(id) ? puppets_[id] : new DollData();

            TrainerStyleCB.SelectedIndex = -1;
            TrainerStyleCB.Items.Clear();
            foreach (var style in data.styles)
            {
                TrainerStyleCB.Items.Add(style.type);
            }

            TrainerAbilityCB.SelectedIndex = -1;
            TrainerAbilityCB.Items.Clear();

            var puppet = dods_[dodindex].puppets[slotindex];

            TrainerLevelSC.ValueChanged -= TrainerLevelSC_ValueChanged;
            TrainerLevelSC.Value         = LevelFromExp(data.cost, puppet.experience);
            TrainerLevelSC.ValueChanged += TrainerLevelSC_ValueChanged;

            if (string.IsNullOrEmpty(puppet.nickname) || (puppet.nickname == puppet_names_[puppet.id]))
            {
                TrainerPuppetNickTB.Text = (id > 0) ? puppet_names_[id] : "";
            }

            dods_[dodindex].puppets[slotindex].id = id;
        }
Ejemplo n.º 6
0
        private void NewPuppetButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(working_dir_) || puppets_.Count == 0)
            {
                ErrMsg("No data loaded!");
                return;
            }

            uint id = 0;

            using (var dialog = new NewIDDialog("New Puppet", 511))
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                id = (uint)dialog.ID;
            }

            if (puppets_.ContainsKey(id))
            {
                ErrMsg("Puppet ID in use! Select a different ID.");
                return;
            }

            if ((id >= puppet_names_.Length) || (id >= 512))
            {
                var min = Math.Min(puppet_names_.Length, 512);
                ErrMsg("Puppet ID too large! ID must be less than " + min.ToString() + ".");
                return;
            }

            uint puppetdex_pos = 0;

            foreach (var i in puppets_)
            {
                if (i.Value.puppetdex_index > puppetdex_pos)
                {
                    puppetdex_pos = i.Value.puppetdex_index;
                }
            }

            if (++puppetdex_pos > 511)
            {
                puppetdex_pos = 0;
            }

            var puppet = new DollData()
            {
                id = id, puppetdex_index = puppetdex_pos
            };

            puppets_[id] = puppet;
            PuppetLB.Items.Add(new Tuple <string, uint>(puppet_names_[id], puppet.id));
            PuppetLB.SelectedIndex = PuppetLB.FindStringExact(puppet_names_[id]);
            obj_flags_[id]         = 1;
            if (is_ynk_)
            {
                obj_flags_[id + 400] = 1;
            }
            for (var i = 0; i < (is_ynk_ ? 4 : 3); ++i)
            {
                puppet_flags_[(id * 4) + i] = 1;
            }
        }
Ejemplo n.º 7
0
    /// <summary>
    /// 해당 코루틴에서 모든 데이터 로드 및 로딩진행 표기 합니다.
    /// 비동기씬로드로 로드진행상황 표시 안됩니다. (슬라이더 90%에서 진행이됨)
    /// </summary>
    /// <param name="data"></param>
    /// <returns></returns>
    private IEnumerator MakeDollData(JsonData data)
    {
        var count = data.Count;
        var list  = new List <DollData>();

        var keys = new List <string>();

        for (int i = 0; i < count; i++)
        {
            var dolldata = new DollData();
            try
            {
                dolldata.id     = (int)data[i]["id"];
                dolldata.name   = data[i]["name"].ToString();
                dolldata.krName = data[i]["krName"].ToString();
                dolldata.rank   = (int)data[i]["rank"];
                dolldata.type   = (DollType)(int)data[i]["type"];


                var effect = new Effect();

                effect.effectType   = (DollType)(int)data[i]["effect"]["effectType"];
                effect.effectCenter = (int)data[i]["effect"]["effectCenter"];

                var arrayCount = data[i]["effect"]["effectPos"].Count;
                effect.effectPos = new int[arrayCount];

                for (int j = 0; j < arrayCount; j++)
                {
                    effect.effectPos[j] = (int)data[i]["effect"]["effectPos"][j];
                }

                arrayCount         = data[i]["effect"]["gridEffect"].Count;
                effect.gridEffects = new Effect.GridEffect[arrayCount];

                keys.Clear();
                keys.AddRange(data[i]["effect"]["gridEffect"].Keys);

                for (int j = 0; j < arrayCount; j++)
                {
                    effect.gridEffects[j] = new Effect.GridEffect(keys[j]
                                                                  , (int)data[i]["effect"]["gridEffect"][keys[j]]);
                }

                //for (int j = 0; j < arrayCount; j++)
                //{
                //    effect.gridEffects[j] = new Effect.GridEffect(
                //        data[i]["effect"]["gridEffect"][j]["type"].ToString()
                //        , (int)data[i]["effect"]["gridEffect"][j]["value"]);
                //}

                dolldata.effect = effect;
            }
            catch
            {
                Debug.Log("Wrong json data " + i);
                continue;
            }

            list.Add(dolldata);
        }

        var sb = new StringBuilder();

        int myCutCount = 0;
        int totalCount = list.Count * 2;
        int currCount  = 0;

        for (int i = 0; i < list.Count; i++)
        {
            sb.Length = 0;
            sb.Append("character/");
            sb.Append(list[i].name);
            sb.Append("/");
            sb.Append(list[i].name);
            sb.Append("_SkeletonData");

            var skel = Resources.Load <SkeletonDataAsset>(sb.ToString());
            if (skel == null)
            {
                Debug.Log("Null " + list[i].name);
                continue;
            }

            var go   = Instantiate(dollPrefab, dollPool.position, Quaternion.identity);
            var doll = go.GetComponent <Doll>();
            doll.tr.SetParent(dollPool, false);

            doll.id       = list[i].id;
            doll.dollData = list[i];
            doll.skelAnim.skeletonDataAsset = skel;
            doll.skelAnim.Reset();

            go.SetActive(false);

            dollDict.Add(list[i].id, doll);

            //LoadingBar
            myCutCount++;
            currCount++;
            if (myCutCount > cutCount)
            {
                myCutCount          = 0;
                loadingSlider.value = (float)currCount / totalCount;
                yield return(null);
            }
            //LoadingBar
        }

        //LoadFromAtlas
        for (int i = 0; i < AtlasPath.Length; i++)
        {
            var pics = Resources.LoadAll <Sprite>(AtlasPath[i]);

            for (int j = 0; j < pics.Length; j++)
            {
                int  key;
                Doll doll;
                //tryparse : false일때 key는 0반환
                if (Int32.TryParse(pics[j].name, out key))
                {
                    if (dollDict.TryGetValue(key, out doll))
                    {
                        doll.profilePic = pics[j];
                        SingleTon.instance.dollList.AddContent(doll);
                    }
                    else
                    {
                        Debug.Log("There is no Key " + key);
                    }
                }
                else
                {
                    Debug.Log("Convert Failed " + pics[j].name);
                }

                //LoadingBar
                myCutCount++;
                currCount++;
                if (myCutCount > cutCount)
                {
                    myCutCount          = 0;
                    loadingSlider.value = (float)currCount / totalCount;
                    yield return(null);
                }
                //LoadingBar
            }
        }

        //로드데이터처리 및 프리셋 초기화
        SingleTon.instance.dollPresetList.InitAllPresets();

        beforeLoadingObject.SetActive(false);
        for (int i = 0; i < afterLoadingObjects.Length; i++)
        {
            afterLoadingObjects[i].SetActive(true);
        }
        //Debug.Log(Time.time);
    }
Ejemplo n.º 8
0
        private void LoadDB()
        {
            string strConn = "Data Source=" + Application.StartupPath + "\\data.db";

            if (!System.IO.File.Exists("data.db"))
            {
                MessageBox.Show("데이터베이스 파일 \"data.db\"를 찾을 수 없습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            var              conn   = new SQLiteConnection(strConn).OpenAndReturn();
            string           sql    = "SELECT * FROM dolls";
            SQLiteCommand    cmd    = new SQLiteCommand(sql, conn);
            SQLiteDataReader reader = null;

            try
            {
                reader = cmd.ExecuteReader();
            }
            catch (SQLiteException)
            {
                MessageBox.Show("데이터베이스 파일 \"data.db\"가 유효하지 않습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            while (reader.Read())
            {
                DollData.Add(new Doll
                {
                    Name    = (string)reader["name"],
                    Grade   = (int)reader["grade"],
                    Time    = (string)reader["time"],
                    Type    = (string)reader["type"],
                    IsHeavy = (bool)reader["isHeavy"]
                });
            }
            reader.Close();
            sql    = "SELECT * FROM equipments";
            cmd    = new SQLiteCommand(sql, conn);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                EquipmentData.Add(new Equipment
                {
                    Name  = (string)reader["name"],
                    Grade = (int)reader["grade"],
                    Time  = (string)reader["time"],
                    Type  = (string)reader["type"],
                });
            }
            reader.Close();
            sql    = "SELECT * FROM fairies";
            cmd    = new SQLiteCommand(sql, conn);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                FairyData.Add(new Fairy
                {
                    Name = (string)reader["name"],
                    Time = (string)reader["time"],
                    Type = (string)reader["type"],
                });
            }
            conn.Close();
        }
Ejemplo n.º 9
0
    private void MakeDollData(JsonData data)
    {
        var count = data.Count;
        var list  = new List <DollData>();

        for (int i = 0; i < count; i++)
        {
            var dolldata = new DollData();

            dolldata.id   = (int)data[i]["id"];
            dolldata.name = data[i]["name"].ToString();
            dolldata.rank = (int)data[i]["rank"];
            dolldata.type = (DollType)(int)data[i]["type"];


            var effect = new Effect();

            effect.effectType   = (DollType)(int)data[i]["effect"]["effectType"];
            effect.effectCenter = (int)data[i]["effect"]["effectCenter"];

            var arrayCount = data[i]["effect"]["effectPos"].Count;
            effect.effectPos = new int[arrayCount];

            for (int j = 0; j < arrayCount; j++)
            {
                effect.effectPos[j] = (int)data[i]["effect"]["effectPos"][j];
            }
            effect.gridEffects = new List <Effect.GridEffect>();

            for (int j = 0; j < data[i]["effect"]["gridEffect"].Count; j++)
            {
                effect.gridEffects.Add(new Effect.GridEffect(
                                           data[i]["effect"]["gridEffect"][j]["type"].ToString()
                                           , (int)data[i]["effect"]["gridEffect"][j]["value"]));
            }

            dolldata.effect = effect;

            list.Add(dolldata);
        }


        var sb = new StringBuilder();

        for (int i = 0; i < list.Count; i++)
        {
            sb.Length = 0;
            sb.Append("character/");
            sb.Append(list[i].name);
            sb.Append("/");
            sb.Append(list[i].name);
            sb.Append("_SkeletonData");

            var skel = Resources.Load <SkeletonDataAsset>(sb.ToString());
            if (skel == null)
            {
                Debug.Log("Null " + list[i].name);
                continue;
            }
            var go = Instantiate(dollPrefab, dollPool.position, Quaternion.identity)
                     as GameObject;
            var doll = go.GetComponent <Doll>();
            doll.tr.SetParent(dollPool, false);

            doll.id       = list[i].id;
            doll.dollData = list[i];
            doll.skelAnim.skeletonDataAsset = skel;
            doll.skelAnim.Reset();
            go.SetActive(false);

            dollDict.Add(list[i].id, doll);

            SingleTon.instance.dollList.AddContent(doll);
        }
    }