207 lines
8.0 KiB
C#
207 lines
8.0 KiB
C#
|
|
using CodeStage.AntiCheat.ObscuredTypes;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 인게임 스킬 선택, 아이템 획득 등
|
||
|
|
/// </summary>
|
||
|
|
public partial class InGameInfo : MyCoroutine
|
||
|
|
{
|
||
|
|
private Dictionary<int, bool> dic_SelectSkill = new Dictionary<int, bool>();
|
||
|
|
private List<ObtainItemData> list_ObtainItem = new List<ObtainItemData>();
|
||
|
|
private List<ObscuredDouble> list_quickamount = new List<ObscuredDouble>();
|
||
|
|
|
||
|
|
void Init_IngameData()
|
||
|
|
{
|
||
|
|
dic_SelectSkill.Clear();
|
||
|
|
list_ObtainItem.Clear();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Add_SelectSkill(int _id)
|
||
|
|
{
|
||
|
|
if (!dic_SelectSkill.ContainsKey(_id))
|
||
|
|
{
|
||
|
|
dic_SelectSkill.Add(_id, false);
|
||
|
|
|
||
|
|
var skilltabledata = table_selectskill.Ins.Get_Data(_id);
|
||
|
|
|
||
|
|
switch (skilltabledata.SkillEffect)
|
||
|
|
{
|
||
|
|
// 이펙트 없는 스킬
|
||
|
|
case eEffect.Select_DoubleShot:
|
||
|
|
case eEffect.Select_TripleShot:
|
||
|
|
case eEffect.Select_Bounce:
|
||
|
|
case eEffect.Select_LeafFairy2:
|
||
|
|
case eEffect.Select_FrostFairy2:
|
||
|
|
case eEffect.Select_WindFairy2:
|
||
|
|
case eEffect.Select_HikikomoriFairy2:
|
||
|
|
case eEffect.Select_Bounce2:
|
||
|
|
break;
|
||
|
|
|
||
|
|
case eEffect.Select_Heal:
|
||
|
|
var heal = skilltabledata.ValueBase; //+ skilltabledata.ValueBase * ServerInfo.Ins.m_ServerData.PC.Get_Value(15); // 코스튬 15
|
||
|
|
ActorInfo.Ins.All_Heal(heal);
|
||
|
|
SoundInfo.Ins.Play_OneShot(eSound.s011_Potion, 0.5f);
|
||
|
|
break;
|
||
|
|
case eEffect.Select_Shield:
|
||
|
|
Set_Skill_ToPet(eEffect.Skill_Shield, false, true, 60f, 0.5f);
|
||
|
|
break;
|
||
|
|
case eEffect.Select_BodyonFire:
|
||
|
|
Shoot_SelectSkill(true, true, skilltabledata.SkillEffect);
|
||
|
|
break;
|
||
|
|
default:
|
||
|
|
if (skilltabledata.SkillEffect != eEffect.None)
|
||
|
|
Shoot_SelectSkill(true, false, skilltabledata.SkillEffect);
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
MyValue.MyPC.Set_Stat_SelectSkill(skilltabledata);
|
||
|
|
ActorInfo.Ins.Get_Actors(eRole.Pet, 0).ForEach(f => f.Set_Stat_SelectSkill(skilltabledata));
|
||
|
|
NewGameUI.Ins.m_BangchiUI.Set_Skill();
|
||
|
|
}
|
||
|
|
|
||
|
|
if (dic_SelectSkill.Count >= 9)
|
||
|
|
{
|
||
|
|
var petskillCount = 0;
|
||
|
|
foreach (var item in dic_SelectSkill)
|
||
|
|
{
|
||
|
|
var skilltabledata = table_selectskill.Ins.Get_Data(item.Key);
|
||
|
|
if (skilltabledata.PetSkill) ++petskillCount;
|
||
|
|
}
|
||
|
|
if (petskillCount >= 9)
|
||
|
|
ServerInfo.Ins.m_ServerData.Add_Item(new ItemData(eItem.Title, 67, 1)); // 칭호 : 펫을 사랑하는
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Shoot_SelectSkill(bool mypc, bool _pets, eEffect effect, float _time = 0f, float _rate = 0f)
|
||
|
|
{
|
||
|
|
if (mypc)
|
||
|
|
{
|
||
|
|
var ptd = new ProjectileData { m_Skill = effect, shooter = MyValue.MyPC };
|
||
|
|
if (effect == eEffect.Select_LeafFairy)
|
||
|
|
ptd.eStartPos = eProjectileStartPos.ShooterCenter;
|
||
|
|
Shoot_Effect(ptd);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (_pets) Set_Skill_ToPet(effect, false, true, _time, _rate);
|
||
|
|
}
|
||
|
|
public bool Set_Skill_ToPet(eEffect _effect, bool isenemy, bool _allpet, float _time, float _rate, int _id = 0, bool _force = false)
|
||
|
|
{
|
||
|
|
if (_allpet)
|
||
|
|
{
|
||
|
|
var pets = ActorInfo.Ins.Get_Actors(eRole.Pet, 0);
|
||
|
|
for (int i = 0; i < pets.Count; i++)
|
||
|
|
{
|
||
|
|
var pet = pets[i];
|
||
|
|
if (!pet.gameObject.activeInHierarchy)
|
||
|
|
{ // 광폭화 상태
|
||
|
|
pet = ActorInfo.Ins.Get_Actors(eRole.Pet, 0, true, true).Find(f => f.Get_ID() == pet.Get_ID());
|
||
|
|
}
|
||
|
|
var ptd = new ProjectileData { m_Skill = _effect, shooter = pet, LifeTime = _time, AddDmgPercent = _rate };
|
||
|
|
Shoot_Effect(ptd);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else if (_id > 0)
|
||
|
|
{
|
||
|
|
var pet = ActorInfo.Ins.Get_Actors(eRole.Pet, 0).Find(f => f.Get_ID() == _id);
|
||
|
|
if (!pet.gameObject.activeInHierarchy)
|
||
|
|
{ // 광폭화 상태
|
||
|
|
pet = ActorInfo.Ins.Get_Actors(eRole.Pet, 0, true, true).Find(f => f.Get_ID() == _id);
|
||
|
|
}
|
||
|
|
if (_force)
|
||
|
|
{
|
||
|
|
var ptd = new ProjectileData { m_Skill = _effect, shooter = pet, LifeTime = _time, AddDmgPercent = _rate };
|
||
|
|
Shoot_Effect(ptd);
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public Dictionary<int, bool> Get_SelectSkills() { return dic_SelectSkill; }
|
||
|
|
|
||
|
|
public Dictionary<int, bool> Get_SelectSkillDatas() { return dic_SelectSkill; }
|
||
|
|
public bool Get_SelectSkillData(eEffect _skill)
|
||
|
|
{
|
||
|
|
foreach (var item in dic_SelectSkill)
|
||
|
|
{
|
||
|
|
var temp = table_selectskill.Ins.Get_Data(item.Key);
|
||
|
|
if (temp != null && temp.SkillEffect == _skill)
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
public void Add_ObtainItem(ItemData id)
|
||
|
|
{
|
||
|
|
// 같은 아이템이 있다면 누적하자.
|
||
|
|
var sameitem = list_ObtainItem.Find(f => f.m_Item == id.ItemType && f.m_ID == id.Get_ID());
|
||
|
|
if (sameitem != null)
|
||
|
|
{
|
||
|
|
sameitem.m_Amount += id.Amount;
|
||
|
|
sameitem.m_Amount.RandomizeCryptoKey();
|
||
|
|
}
|
||
|
|
else
|
||
|
|
list_ObtainItem.Add(new ObtainItemData { m_ID = id.Get_ID(), m_Item = id.ItemType, m_Amount = id.Amount });
|
||
|
|
|
||
|
|
if (NewGameUI.Ins.m_BangchiUI.isActiveAndEnabled) NewGameUI.Ins.m_BangchiUI.Set_Item();
|
||
|
|
}
|
||
|
|
public List<ObtainItemData> Get_ObtainItems() { return list_ObtainItem; }
|
||
|
|
public void SaveItems()
|
||
|
|
{
|
||
|
|
// TODO 정인호 : 컨텐츠 드랍 주석처리
|
||
|
|
//var chapter = Get_CurStageData().Chapter;
|
||
|
|
//if (chapter > 100 && chapter < 105) // 투견장은 불필요
|
||
|
|
//{
|
||
|
|
// var sdata = ServerInfo.Ins.m_ServerData;
|
||
|
|
// // Gold, Gem, WeaponStone, RingStone, NeckStone, BootsStone, FairyStone, Exp, 상자1, 상자2, 상자3, 과일, 씨앗, 드랍아이템
|
||
|
|
// list_quickamount.ForEach(f => f = 0);
|
||
|
|
// list_quickamount.ForEach(f => f.RandomizeCryptoKey());
|
||
|
|
// var obtainitems = Get_ObtainItems();
|
||
|
|
// list_quickamount[0] = System.Math.Truncate(GameUI.Ins.IngameUI.m_StageResult.Get_Gold());
|
||
|
|
// list_quickamount[7] = System.Math.Truncate(GameUI.Ins.IngameUI.m_StageResult.Get_Exp());
|
||
|
|
// for (int i = 0; i < obtainitems.Count; i++)
|
||
|
|
// {
|
||
|
|
// int index = Get_QuickIndex(obtainitems[i].m_Item, obtainitems[i].m_ID);
|
||
|
|
// if (index > -1)
|
||
|
|
// list_quickamount[index] += Mathf.Max(1, (int)obtainitems[i].m_Amount);
|
||
|
|
// }
|
||
|
|
|
||
|
|
// var quickdata = sdata.QuickMemory[chapter.ToString()];
|
||
|
|
// for (int i = 0; i < quickdata.Count; i++)
|
||
|
|
// {
|
||
|
|
// if (quickdata[i] < list_quickamount[i])
|
||
|
|
// {
|
||
|
|
// quickdata[i] = list_quickamount[i];
|
||
|
|
// quickdata[i].RandomizeCryptoKey();
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
//}
|
||
|
|
|
||
|
|
list_ObtainItem.ForEach(f => ServerInfo.Ins.m_ServerData.Add_Item(new ItemData(f.m_Item, f.m_ID, f.m_Amount, "end", eUICardType.GetItem)));
|
||
|
|
list_ObtainItem.Clear();
|
||
|
|
}
|
||
|
|
int Get_QuickIndex(eItem item, int _id = 0)
|
||
|
|
{
|
||
|
|
int index = -1;
|
||
|
|
switch (item)
|
||
|
|
{
|
||
|
|
case eItem.Gem: index = 1; break;
|
||
|
|
case eItem.WeaponStone: index = 2; break;
|
||
|
|
case eItem.RingStone: index = 3; break;
|
||
|
|
case eItem.NeckStone: index = 4; break;
|
||
|
|
case eItem.BootsStone: index = 5; break;
|
||
|
|
case eItem.FairyStone: index = 6; break;
|
||
|
|
case eItem.Food: index = 11; break;
|
||
|
|
case eItem.Seed: index = 12; break;
|
||
|
|
default: index = 13; break;
|
||
|
|
}
|
||
|
|
return index;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public class ObtainItemData
|
||
|
|
{
|
||
|
|
public eItem m_Item;
|
||
|
|
public ObscuredInt m_ID;
|
||
|
|
public ObscuredDouble m_Amount;
|
||
|
|
}
|