//


    public InGameSystem()
    {
        //初始化系统
        heroSystem     = new HeroSystem(this);
        synopsisSystem = new SynopsisSystem(this);
        Init(heroSystem);
    }
Beispiel #2
0
 public void SetImageAndTextSelectHeroPanel()
 {
     for (int i = 0; i < User.stageHeros.Length; i++)
     {
         HeroData data = HeroSystem.GetUserHero(User.stageHeros[i]);
         selectPanel          = PanelHeroSelection.transform.GetChild(i).GetChild(2).gameObject;
         selectedHeroNameText = PanelHeroSelection.transform.GetChild(i).GetChild(0).GetComponent <Text>();
         selectedHeroImage    = PanelHeroSelection.transform.GetChild(i).GetChild(1).GetChild(0).GetComponent <Image>();
         if (data != null)
         {
             selectPanel.gameObject.SetActive(false);
             selectedHeroNameText.text = string.Format("<size='{0}'>{1} {2}</size>  {3}", selectedHeroNameText.fontSize - 5, LocalizationManager.GetText("Level"), data.level, HeroSystem.GetHeroName(data.id));
             selectedHeroImage.enabled = true;
             selectedHeroImage.sprite  = Resources.Load <Sprite>(data.image);
         }
         else
         {
             selectedHeroImage.enabled = false;
             selectedHeroImage.sprite  = HeroSystem.GetHeroNoneImage();
             selectedHeroNameText.text = "";
             selectPanel.gameObject.SetActive(true);
         }
     }
     selectHeroLockCover.SetActive(true);
 }
Beispiel #3
0
    public IEnumerator StageClearing()
    {
        isStartGame = false;
        isEndGame   = true;
        HeroSystem.SaveHeros(Common.FindAlly());
        MapSystem.MapClear(stageInfo.mapNumber, stageInfo.stageClearPoint);
        MissionSystem.AddClearPoint(MissionSystem.ClearType.StageClear);
        MissionSystem.AddClearPoint(MissionSystem.ClearType.TotalStageCount);
        MissionSystem.PointSave();
        SaveSystem.AddUserCoin(stageInfo.stageCoin);
        stageInfo.stageExp = Common.GetUserExp(stageInfo.stageNumber);
        SaveSystem.ExpUp(stageInfo.stageExp);
        var getItems = GetStageItems();

        for (var i = 0; i < getItems.Count; i++)
        {
            ItemSystem.SetObtainItem(getItems[i].id);
        }
        GoogleSignManager.SaveData();
        UI_Manager.instance.OpenEndGamePanel(true);
        if (UnityEngine.Random.Range(0, 10) < 2)
        {
            GoogleAdMobManager.instance.OnBtnViewAdClicked();
        }
        yield return(null);
    }
Beispiel #4
0
    public void ShowHero(GameObject hero, HeroData heroData)
    {
        if (hero != null)
        {
            targetHeroData = heroData;
            showHeroObj    = Instantiate(hero, HeroShowPoint.transform);
            showHeroObj.transform.localScale    = new Vector3(200, 200, 200);
            showHeroObj.transform.localPosition = Vector3.zero;

            if (showHeroObj.GetComponent <Hero>() != null)
            {
                Destroy(showHeroObj.GetComponent <Hero>());
            }
            if (showHeroObj.GetComponent <Rigidbody2D>() != null)
            {
                Destroy(showHeroObj.GetComponent <Rigidbody2D>());
            }
            foreach (var sp in showHeroObj.GetComponentsInChildren <SpriteRenderer>())
            {
                sp.sortingLayerName = "ShowObject";
                sp.gameObject.layer = 16;
            }
            showHeroObj.gameObject.SetActive(true);

            if (heroNameText != null)
            {
                heroNameText.text = HeroSystem.GetHeroName(heroData.id);
            }
            if (heroDescriptionText != null)
            {
                heroDescriptionText.text = HeroSystem.GetHeroDescription(heroData.id);
            }
            if (heroLevelText != null)
            {
                heroLevelText.text = string.Format("LV {0}", heroData.level);
            }
            if (heroExpText != null)
            {
                int   exp        = targetHeroData.exp;
                int   needExp    = Common.GetHeroNeedExp(targetHeroData.level);
                float expPercent = ((float)exp / (float)needExp);
                heroExpText.text    = string.Format("{0}/{1}({2}%)", exp, needExp, (expPercent * 100).ToString("N0"));
                heroExpSlider.value = expPercent;
            }

            if (CharactersManager.instance.GetLobbyHeros(targetHeroData.id))
            {
                heroSetLobbyButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("heroInfoExceptLobbyButton");
            }
            else
            {
                heroSetLobbyButton.GetComponentInChildren <Text>().text = LocalizationManager.GetText("heroInfoToLobbyButton");
            }

            RefreshHeroStatusEquipmentPanel();
        }
    }
Beispiel #5
0
 //装备构造
 public Equips(HeroSystem _heroSystem)
 {
     heroSystem = _heroSystem;
     //初始化字典
     itemInfo = new Dictionary <int, int>();
     for (int i = 1; i <= 6; i++)
     {
         itemInfo.Add(i, -1);
     }
 }
Beispiel #6
0
 private void Start()
 {
     HeroSystem.LoadHero();
     SkillSystem.LoadSkill();
     AbilitySystem.LoadAbility();
     ItemSystem.LoadItem();
     MapSystem.LoadMap();
     MissionSystem.LoadMission();
     LocalizationManager.LoadLanguage(User.language);
 }
Beispiel #7
0
 public IEnumerator StageFailing()
 {
     HeroSystem.SaveHeros(Common.FindAlly());
     isEndGame   = true;
     isStartGame = false;
     GoogleSignManager.SaveData();
     UI_Manager.instance.OpenEndGamePanel(false);
     GoogleAdMobManager.instance.OnBtnViewAdClicked();
     yield return(null);
 }
Beispiel #8
0
 void RefreshUI()
 {
     if (heroSlotPrefab != null)
     {
         foreach (Transform child in ScrollViewContent.transform)
         {
             if (!child.name.Equals("none"))
             {
                 Destroy(child.gameObject);
             }
         }
         foreach (var heroSlot in HeroSystem.GetUserHeros())
         {
             if (heroSlot.type == 0)
             {
                 GameObject slotPrefab = Instantiate(heroSlotPrefab, ScrollViewContent.transform);
                 foreach (var i in slotPrefab.GetComponentsInChildren <Text>())
                 {
                     if (i.name.Equals("heroName"))
                     {
                         slotNameText = i;
                     }
                 }
                 if (slotNameText != null)
                 {
                     slotNameText.text = HeroSystem.GetHeroName(heroSlot.id);
                 }
                 slotHeroImage = slotPrefab.transform.GetChild(0).GetChild(0).GetComponent <Image>();
                 if (slotHeroImage != null)
                 {
                     slotHeroImage.sprite = Resources.Load <Sprite>(heroSlot.image);
                 }
                 slotPrefab.GetComponent <Button>().onClick.RemoveAllListeners();
                 slotPrefab.GetComponent <Button>().onClick.AddListener(delegate
                 {
                     OnItemSlotClick(heroSlot);
                 });
                 if (!CharactersManager.instance.IsExistedStageHero(heroSlot.id))
                 {
                     slotPrefab.GetComponent <Button>().enabled = true;
                     slotPrefab.transform.GetChild(2).gameObject.SetActive(false);
                 }
                 else
                 {
                     slotPrefab.GetComponent <Button>().enabled = false;
                     slotPrefab.transform.GetChild(2).gameObject.SetActive(true);
                 }
             }
         }
     }
     useEnergyText.text = CharactersManager.instance.GetStageHeroCount().ToString();
     SetImageAndTextSelectHeroPanel();
     RefreshPlayerSkillUI();
     selectHeroLockCover.SetActive(true);
 }
Beispiel #9
0
    public static void SetArchivementClearPoint()
    {
        int[] setCheckTypes = { 7, 8, 9, 14, 15 };
        int   point         = 0;

        for (var j = 0; j < setCheckTypes.Length; j++)
        {
            List <Mission> currentMissions = userMissions.FindAll(x => !x.enable && !x.clear && x.clearType == setCheckTypes[j]);
            for (var i = 0; i < currentMissions.Count; i++)
            {
                if (currentMissions[i].missionType == 2)
                {
                    switch (currentMissions[i].clearType)
                    {
                    case 7:
                        point = User.level;
                        break;

                    case 8:
                        point = 0;
                        foreach (var hero in HeroSystem.GetUserHeros())
                        {
                            point += hero.level;
                        }
                        break;

                    case 9:
                        point = User.flatEnergyMaxLevel + User.flatEnergyChargingLevel + User.addMoneyLevel + User.addExpLevel + User.addAttackLevel + User.addDefenceLevel;
                        break;

                    case 14:
                        point = 0;
                        foreach (var skill in SkillSystem.GetPlayerSkillList())
                        {
                            point += SkillSystem.GetUserSkillLevel(skill.id);
                        }
                        break;

                    case 15:
                        point = 0;
                        foreach (var skill in SkillSystem.GetUserHerosSkills())
                        {
                            point += SkillSystem.GetUserSkillLevel(skill.id);
                        }
                        break;
                    }
                    currentMissions[i].point = point;
                    Debugging.Log(MissionSystem.GetMissionName(currentMissions[i].id) + " 의 포인트 > " + point);
                }
            }
        }
        Debugging.Log("업적 세팅타입 설정완료");
    }
Beispiel #10
0
    public static int GetHeroEquipmentItemMoveSpeed(ref HeroData heroData)
    {
        int mSpeed = 0;

        int[] heroItems = HeroSystem.GetHeroEquipmentItems(heroData.id);
        for (int i = 0; i < heroItems.Length; i++)
        {
            if (heroItems[i] != 0)
            {
                Item item = ItemSystem.GetUserEquipmentItem(heroItems[i]);
                mSpeed += item != null?ItemMoveSpeed(item) : 0;
            }
        }
        return(mSpeed);
    }
Beispiel #11
0
    public static int GetHeroEquipmentItemCritical(ref HeroData heroData)
    {
        int cri = 0;

        int[] heroItems = HeroSystem.GetHeroEquipmentItems(heroData.id);
        for (int i = 0; i < heroItems.Length; i++)
        {
            if (heroItems[i] != 0)
            {
                Item item = ItemSystem.GetUserEquipmentItem(heroItems[i]);
                cri += item != null?ItemCritical(item) : 0;
            }
        }
        return(cri);
    }
Beispiel #12
0
    public static int GetHeroEquipmentItemSkillEnergy(ref HeroData heroData)
    {
        int energy = 0;

        int[] heroItems = HeroSystem.GetHeroEquipmentItems(heroData.id);
        for (int i = 0; i < heroItems.Length; i++)
        {
            if (heroItems[i] != 0)
            {
                Item item = ItemSystem.GetUserEquipmentItem(heroItems[i]);
                energy += item != null?ItemSkillEnergy(item) : 0;
            }
        }
        return(energy);
    }
Beispiel #13
0
    public static int GetHeroEquipmentItemDefence(ref HeroData heroData)
    {
        int defence = 0;

        int[] heroItems = HeroSystem.GetHeroEquipmentItems(heroData.id);
        for (int i = 0; i < heroItems.Length; i++)
        {
            if (heroItems[i] != 0)
            {
                Item item = ItemSystem.GetUserEquipmentItem(heroItems[i]);
                defence += item != null?ItemDefence(item) : 0;
            }
        }
        return(defence);
    }
Beispiel #14
0
    public static int GetHeroEquipmentItemAttack(ref HeroData heroData)
    {
        int attack = 0;

        int[] heroItems = HeroSystem.GetHeroEquipmentItems(heroData.id);
        for (int i = 0; i < heroItems.Length; i++)
        {
            if (heroItems[i] != 0)
            {
                Item item = ItemSystem.GetUserEquipmentItem(heroItems[i]);

                attack += item != null?ItemAttack(item) : 0;
            }
        }
        return(attack);
    }
Beispiel #15
0
    public static void SaveUser(int id)
    {
        string      path   = Application.persistentDataPath + "/Xml/Heros.Xml";
        XmlDocument xmlDoc = new XmlDocument();

        if (System.IO.File.Exists(path))
        {
            xmlDoc.LoadXml(System.IO.File.ReadAllText(path));
        }

        //복호화////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        decrpytData = DataSecurityManager.DecryptData(elmRoot.InnerText);

        elmRoot.InnerXml = decrpytData;
        //////////

        XmlNodeList nodes = xmlDoc.SelectNodes("HeroCollection/Heros/Hero");

        foreach (XmlNode node in nodes)
        {
            if (node.Attributes.GetNamedItem("id").Value == id.ToString() || node.Attributes.GetNamedItem("id").Value.Equals(id.ToString()))
            {
                HeroData hd = HeroSystem.GetUserHero(id);
                if (hd != null)
                {
                    node.SelectSingleNode("Level").InnerText         = hd.level.ToString();
                    node.SelectSingleNode("Exp").InnerText           = hd.exp.ToString();
                    node.SelectSingleNode("Strength").InnerText      = hd.strength.ToString();
                    node.SelectSingleNode("Intelligent").InnerText   = hd.intelligent.ToString();
                    node.SelectSingleNode("Physical").InnerText      = hd.physical.ToString();
                    node.SelectSingleNode("Agility").InnerText       = hd.agility.ToString();
                    node.SelectSingleNode("EquipmentItem").InnerText = hd.equipmentItem.ToString();
                }
                break;
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(id + " 영웅의 단일 xml 저장 완료");
    }
Beispiel #16
0
    public static void AddUser(int id)
    {
        string      path   = Application.persistentDataPath + "/Xml/Heros.Xml";
        XmlDocument xmlDoc = new XmlDocument();

        if (System.IO.File.Exists(path))
        {
            xmlDoc.LoadXml(System.IO.File.ReadAllText(path));
        }

        //복호화////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        decrpytData = DataSecurityManager.DecryptData(elmRoot.InnerText);

        elmRoot.InnerXml = decrpytData;
        //////////
        CreateNode(HeroSystem.GetHero(id), xmlDoc, path);
    }
 void RefreshUI()
 {
     if (heroSlotPrefab != null)
     {
         foreach (Transform child in ScrollViewContent.transform)
         {
             Destroy(child.gameObject);
         }
         foreach (var heroSlot in HeroSystem.GetUserHeros())
         {
             if (heroSlot.type == 0)
             {
                 GameObject slotPrefab = Instantiate(heroSlotPrefab, ScrollViewContent.transform);
                 foreach (var i in slotPrefab.GetComponentsInChildren <Text>())
                 {
                     if (i.name.Equals("heroName"))
                     {
                         slotNameText = i;
                     }
                 }
                 if (slotNameText != null)
                 {
                     slotNameText.text = HeroSystem.GetHeroName(heroSlot.id);
                 }
                 slotHeroImage = slotPrefab.transform.GetChild(0).GetChild(0).GetComponent <Image>();
                 if (slotHeroImage != null)
                 {
                     slotHeroImage.sprite = Resources.Load <Sprite>(heroSlot.image);
                 }
                 slotPrefab.GetComponent <Button>().onClick.RemoveAllListeners();
                 slotPrefab.GetComponent <Button>().onClick.AddListener(delegate
                 {
                     OnItemSlotClick(heroSlot);
                 });
             }
         }
     }
 }