Esempio n. 1
0
    private static List <Item> SetOrderByItemList(List <Item> itemList, Common.OrderByType orderByType)
    {
        if (itemList != null)
        {
            switch (orderByType)
            {
            case Common.OrderByType.NAME:
                itemList.Sort((i1, i2) => GetItemName(i1.id).CompareTo(GetItemName(i2.id)));
                break;

            case Common.OrderByType.VALUE:
                itemList.Sort((i1, i2) => i2.itemClass.CompareTo(i1.itemClass));
                break;
            }
            return(itemList);
        }
        else
        {
            Debugging.Log("정렬할 아이템 리스트가 null 입니다.");
            return(null);
        }
    }
Esempio n. 2
0
    public void OnClickRewardButton(int id)
    {
        Mission mission = MissionSystem.GetUserMission(id);

        if (mission != null && mission.enable && !mission.clear)
        {
            MissionSystem.ClearMission(id);
            MissionSystem.RewardType rewardType = (MissionSystem.RewardType)mission.rewardType;

            switch (rewardType)
            {
            case MissionSystem.RewardType.coin:
                SaveSystem.AddUserCoin(mission.rewardItemCount);
                UI_Manager.instance.ShowGetAlert(Common.GetCoinCrystalEnergyImagePath(0), string.Format("<color='yellow'>{0}</color> {1} {2}", LocalizationManager.GetText("Coin"), mission.rewardItemCount, LocalizationManager.GetText("alertGetMessage4")));
                break;

            case MissionSystem.RewardType.crystal:
                SaveSystem.AddUserCrystal(mission.rewardItemCount);
                UI_Manager.instance.ShowGetAlert(Common.GetCoinCrystalEnergyImagePath(1), string.Format("<color='yellow'>{0}</color> {1} {2}", LocalizationManager.GetText("Crystal"), mission.rewardItemCount, LocalizationManager.GetText("alertGetMessage4")));
                break;

            case MissionSystem.RewardType.energy:
                SaveSystem.AddUserEnergy(mission.rewardItemCount);
                UI_Manager.instance.ShowGetAlert(Common.GetCoinCrystalEnergyImagePath(2), string.Format("<color='yellow'>{0}</color> {1} {2}", LocalizationManager.GetText("Energy"), mission.rewardItemCount, LocalizationManager.GetText("alertGetMessage4")));
                break;

            case MissionSystem.RewardType.scroll:
                ItemSystem.SetObtainItem(mission.rewardItemId, mission.rewardItemCount);
                Item rewardItem = ItemSystem.GetItem(mission.rewardItemId);
                UI_Manager.instance.ShowGetAlert(rewardItem.image, string.Format("<color='yellow'>{0}</color> {1}", rewardItem.name, LocalizationManager.GetText("alertGetMessage3")));
                break;
            }
        }
        else
        {
            Debugging.Log(id + " 의 미션클리어 실패");
        }
        RefreshUI();
    }
Esempio n. 3
0
 public void OnClickItemToInventory(Item sellItem, Button button)
 {
     if (SellListContentView != null)
     {
         if (sellItemList.Count > 0)
         {
             sellItemList.Remove(sellItem);
             userItemList.Add(sellItem);
             totalValue = 0;
             totalCount = sellItemList.Count;
             foreach (var item in sellItemList)
             {
                 totalValue += ItemSystem.ItemValue(item);
             }
             SetActionInfo(totalCount, totalValue, true);
             RefreshUI();
         }
         else
         {
             Debugging.Log("리스트가 가득참");
         }
     }
 }
Esempio n. 4
0
 void OnSkillButtonClick(int index, int id)
 {
     if (id != 0)
     {
         var stageHero  = CharactersManager.instance.GetCurrentInStageHero(id).GetComponent <Hero>();
         int needEnergy = (int)skillNeedEnergys[index];
         if (stageHero != null && stageHero.isSkillAble() && StageManagement.instance.IsSkillAble(needEnergy))
         {
             SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_pop);
             stageHero.SkillAttack();
             this.transform.GetChild(index).GetComponentInChildren <Button>().interactable = false;
             GameObject clickEffect = EffectPool.Instance.PopFromPool("BalloonPopExplosion");
             clickEffect.transform.position = this.transform.GetChild(index).transform.position;
             clickEffect.SetActive(true);
             StartCoroutine(ClickingSkillButton(this.transform.GetChild(index).GetComponentInChildren <Animator>()));
             StageManagement.instance.UseSkill(needEnergy);
         }
         else
         {
             Debugging.Log(id + " 영웅의 스킬을 사용할 수 없습니다.");
         }
     }
 }
Esempio n. 5
0
 // 맵노드 클릭 이벤트
 public void OnMapNodeClick(int mapId)
 {
     SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default);
     if (MapSystem.isAbleMap(mapId))
     {
         currentMapId     = mapId;
         mapNameText.text = string.Format("{0} <size='40'>{1}</size>", MapSystem.GetStageName(MapSystem.GetMap(currentMapId).stageNumber - 1), MapSystem.GetMap(currentMapId).name);
         foreach (var node in mapNodeList)
         {
             if (node.Key == mapId)
             {
                 mapNodeImage = node.Value.GetComponent <Image>();
                 break;
             }
         }
         mapInfoPanel.GetComponent <AiryUIAnimatedElement>().ShowElement();
         ShowHero();
     }
     else
     {
         Debugging.Log(mapId + " 의 맵은 아직 열리지 않은 맵입니다.");
     }
 }
 public override void OnUpdate(float deltaTime)
 {
     if (Keyboard.IsKeyPressed(Key.W))
     {
         Debugging.Log(LogEntryType.Debug, "W pressed");
         Camera.Y -= velocity * Time.DeltaTime;
     }
     if (Keyboard.IsKeyPressed(Key.A))
     {
         Debugging.Log(LogEntryType.Debug, "A pressed");
         Camera.X -= velocity * Time.DeltaTime;
     }
     if (Keyboard.IsKeyPressed(Key.S))
     {
         Debugging.Log(LogEntryType.Debug, "S pressed");
         Camera.Y += velocity * Time.DeltaTime;
     }
     if (Keyboard.IsKeyPressed(Key.D))
     {
         Debugging.Log(LogEntryType.Debug, "D pressed");
         Camera.X += velocity * Time.DeltaTime;
     }
 }
Esempio n. 7
0
    public static bool UseItem(int id, int count)
    {
        Item useItem = userItems.Find(item => item.customId == id || item.customId.Equals(id));

        Debugging.Log("#2 >>" + useItem.name + "#" + useItem.customId + "#" + useItem.id);
        if (useItem != null)
        {
            if (useItem.count - count <= 0)
            {
                //xml삭제
                userItems.Remove(useItem);
                if (useItem.itemtype == 0)
                {
                    ItemDatabase.DeleteEquipItemSave(useItem.customId);
                }
                else
                {
                    ItemDatabase.DeleteItemSave(useItem.id);
                }

                Debugging.Log(useItem.name + "을 " + count + "개 사용하여 0개가 남아서 XML에서 삭제되었습니다.");
                return(true);
            }
            else
            {
                useItem.count -= count;
                ItemDatabase.ItemSave(useItem.id);
                Debugging.Log(useItem.name + "을 " + count + "개 사용하여 " + useItem.count + "개 남았습니다.");
                return(true);
            }
        }
        else
        {
            Debugging.LogWarning(id + " 아이템이 NULL 입니다.");
            return(false);
        }
    }
Esempio n. 8
0
    public static void ItemSave(int id)
    {
        string      path   = Application.persistentDataPath + "/Xml/Item.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("ItemCollection/Items/Item");

        Debugging.Log(id + "아이템 데이터 xml 저장중..");
        foreach (XmlNode node in nodes)
        {
            if (node.Attributes.GetNamedItem("id").Value == id.ToString() || node.Attributes.GetNamedItem("id").Value.Equals(id.ToString()))
            {
                node.SelectSingleNode("Enable").InnerText = ItemSystem.GetUserItem(id).enable.ToString().ToLower();
                node.SelectSingleNode("Count").InnerText  = ItemSystem.GetUserItem(id).count.ToString();
                break;
            }
        }
        // 암호화/////
        var encrpytData = DataSecurityManager.EncryptData(elmRoot.InnerXml);

        elmRoot.InnerText = encrpytData;
        ////////////
        xmlDoc.Save(path);
        Debugging.Log(id + " 의 아이템 데이터 xml 저장 완료");
    }
Esempio n. 9
0
    IEnumerator StartEvolution()
    {
        yield return(new WaitForEndOfFrame());

        //ItemSystem.UseEquipmentItem(targetItem.customId, 1);
        targetItemSlotImage.GetComponent <AiryUIAnimatedElement>().HideElement();
        yield return(new WaitForSeconds(0.1f));

        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.equip);
        ItemSystem.UseItem(targetItem.customId, 1);
        matItemSlotImage1.GetComponent <AiryUIAnimatedElement>().HideElement();
        matItemSlotImage2.GetComponent <AiryUIAnimatedElement>().HideElement();
        foreach (var i in matItems.Values)
        {
            ItemSystem.UseItem(i.customId, 1);
            yield return(new WaitForSeconds(0.1f));
        }
        yield return(new WaitForSeconds(0.5f));

        EffectManager.SkillUpgradeEffect(resultItemSlot.transform);
        yield return(new WaitForSeconds(0.3f));

        SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.dropItem);
        ItemSystem.SetObtainItem(ItemSystem.GetNextClassItemId(targetItem));
        resultItem = ItemSystem.GetItem(ItemSystem.GetNextClassItemId(targetItem));
        resultItemSlotImage.GetComponent <AiryUIAnimatedElement>().ShowElement();

        Debugging.Log("합성성공!");
        MissionSystem.AddClearPoint(MissionSystem.ClearType.EquipUpgrade);
        targetItem = null;
        matItems.Clear();
        evolutionButton.interactable = true;
        isEndEvolution = true;
        RefreshUI();
        yield return(null);
    }
Esempio n. 10
0
    IEnumerator Start()
    {
        //Caching.ClearCache();
        UI_StartManager.instance.ShowDownloadUI();
        yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetBundle(BundleManagerURL, version, false, 0.0f, "게임매니저")));

        UI_StartManager.instance.SetDownloadCount(4);

        if (AssetBundleManager.Instance.isVersionAdded(BundleManagerURL, version))
        {
            yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetFromABAsync(BundleManagerURL, version, "LoadSceneManager")));

            GameObject obj = AssetBundleManager.Instance.GetLoadedAsset(BundleManagerURL, version, "LoadSceneManager") as GameObject;
            InstantiateAsset(obj, this.transform);

            yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetFromABAsync(BundleManagerURL, version, "PrefabDatabase")));

            GameObject obj2 = AssetBundleManager.Instance.GetLoadedAsset(BundleManagerURL, version, "PrefabDatabase") as GameObject;
            InstantiateAsset(obj2, this.transform);

            yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetFromABAsync(BundleManagerURL, version, "SoundManager")));

            GameObject obj3 = AssetBundleManager.Instance.GetLoadedAsset(BundleManagerURL, version, "SoundManager") as GameObject;
            InstantiateAsset(obj3, this.transform);

            yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetFromABAsync(BundleManagerURL, version, "EffectPoolManager")));

            GameObject obj4 = AssetBundleManager.Instance.GetLoadedAsset(BundleManagerURL, version, "EffectPoolManager") as GameObject;
            InstantiateAsset(obj4, this.transform);
        }
        AssetBundleManager.Instance.RemoveAssetBundle(BundleManagerURL, version);
        Debugging.Log("매니저다운 끝");
        version = 1;
        yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetBundle(BundleHeroURL, version, false, 0.0f, "영웅데이터")));

        UI_StartManager.instance.SetDownloadCount(17);
        if (AssetBundleManager.Instance.isVersionAdded(BundleHeroURL, version))
        {
            // 영웅 프리팹
            for (int i = 0; i < 9; i++)
            {
                yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetFromABAsync(BundleHeroURL, version, string.Format("Hero{0:D3}", (i + 1)))));

                PrefabsDatabaseManager.instance.AddPrefabToHeroList(AssetBundleManager.Instance.GetLoadedAsset(BundleHeroURL, version, string.Format("Hero{0:D3}", (i + 1))) as GameObject);
            }

            // 몬스터 프리팹
            for (int i = 0; i < 6; i++)
            {
                yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetFromABAsync(BundleHeroURL, version, string.Format("Monster{0:D3}", (i + 1)))));

                PrefabsDatabaseManager.instance.AddPrefabToMonsterList(AssetBundleManager.Instance.GetLoadedAsset(BundleHeroURL, version, string.Format("Monster{0:D3}", (i + 1))) as GameObject);
            }
            for (int i = 0; i < 2; i++)
            {
                yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetFromABAsync(BundleHeroURL, version, string.Format("Boss{0:D3}", (i + 1)))));

                PrefabsDatabaseManager.instance.AddPrefabToMonsterList(AssetBundleManager.Instance.GetLoadedAsset(BundleHeroURL, version, string.Format("Boss{0:D3}", (i + 1))) as GameObject);
            }
            // 캐슬
            for (int i = 0; i < 1; i++)
            {
                yield return(StartCoroutine(AssetBundleManager.Instance.LoadAssetFromABAsync(BundleHeroURL, version, string.Format("Castle{0:D3}", (i + 1)))));

                PrefabsDatabaseManager.instance.AddPrefabToCastleList(AssetBundleManager.Instance.GetLoadedAsset(BundleHeroURL, version, string.Format("Castle{0:D3}", (i + 1))) as GameObject);
            }
            yield return(new WaitForSeconds(0.1f));

            PrefabsDatabaseManager.instance.GetPrefabList();
        }
        Debugging.Log("영웅다운 끝");
        AssetBundleManager.Instance.RemoveAllAssetBundles();
        // 로그인 시도
        if (PlayerPrefs.GetInt("ServiceConsent") != 1)
        {
            UI_StartManager.instance.ShowConsnetUI();
        }
        else
        {
            GoogleSignManager.Instance.Init();
        }
    }
Esempio n. 11
0
    public void OnClick()
    {
        StopPause();
        switch (buttonType)
        {
        case ButtonType.ActiveControll:
            OnButtonEffectSound();
            if (targetUI != null)
            {
                if (!targetUI.activeSelf)
                {
                    targetUI.SetActive(true);
                    targetUI.SetActive(true);
                    showUIanimation();
                }
                else
                {
                    targetUI.SetActive(false);
                    //hideUIanimation();
                }
            }
            break;

        case ButtonType.Trigger:
            break;

        case ButtonType.StageSceneLoad:
            int stageHeroCount = CharactersManager.instance.GetStageHeroCount();
            if (stageHeroCount < 1)
            {
                Debugging.Log("영웅을 선택해주세요");
            }
            else
            {
                if (ItemSystem.IsGetAbleItem())
                {
                    if (Common.PaymentCheck(ref User.portalEnergy, stageHeroCount))
                    {
                        OnButtonEffectSound();
                        Debugging.Log(stageHeroCount + " 에너지 소모. 전투씬 로드 시작 > " + User.portalEnergy);
                        SaveSystem.SavePlayer();
                        LoadSceneManager.instance.LoadStageScene(stageType);
                        this.GetComponent <Button>().interactable = false;
                    }
                    else
                    {
                        UI_Manager.instance.ShowAlert(UI_Manager.PopupAlertTYPE.energy, stageHeroCount);
                    }
                }
                else
                {
                    UI_Manager.instance.ShowAlert("", LocalizationManager.GetText("alertUnableGetItemMessage"));
                }
            }
            break;

        case ButtonType.SceneLoad:
            OnButtonEffectSound();
            LoadSceneManager.instance.LoadScene(targetSceneNumber);
            this.GetComponent <Button>().interactable = false;
            break;

        case ButtonType.SceneLoadAddtive:
            OnButtonEffectSound();
            LoadSceneManager.instance.LoadSceneAddtive(targetSceneNumber);
            this.GetComponent <Button>().interactable = false;
            break;

        case ButtonType.ItemBuy:
            BuyStart();
            break;

        case ButtonType.CharacterBuy:
            BuyStart(1);
            break;

        case ButtonType.ScenePause:
            OnButtonEffectSound();
            if (targetUI != null)
            {
                if (!targetUI.activeSelf)
                {
                    targetUI.SetActive(true);
                    targetUI.SetActive(true);
                    showUIanimation();
                    Invoke("StartPause", 0.75f);
                }
                else
                {
                    targetUI.SetActive(false);
                    StopPause();
                    //hideUIanimation();
                }
            }
            break;

        case ButtonType.ItemSell:
            SellStart();
            break;

        case ButtonType.Gacha:
            GachaStart();
            break;

        case ButtonType.InventoryAdd:
            InventoryAddStart();
            break;
        }
    }
Esempio n. 12
0
 public void EquipmentEvent(int id)
 {
     HeroSystem.EquipHeroEquimentItem(equipmentSlotIndex, targetHeroId, ItemSystem.GetUserEquipmentItem(id));
     Debugging.Log(id + " 아이템 장착성공");
     this.gameObject.SetActive(false);
 }
Esempio n. 13
0
 public void SetStageHeros(int index, int id)
 {
     User.stageHeros[index] = id;
     Debugging.Log(index + " 열에 " + id + "의 영웅 추가됨 >> " + User.stageHeros[index]);
 }
Esempio n. 14
0
    void TestEventKey()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
            Debugging.Log("F1 >> " + "카메라효과를 끕니다.");
            Common.CameraAllEffectOff();
        }
        else if (Input.GetKeyDown(KeyCode.F2))
        {
            float timeScale = 1;
            if (Time.timeScale == 1f)
            {
                timeScale = 2f;
            }
            else if (Time.timeScale == 2f)
            {
                timeScale = 4f;
            }
            else
            {
                timeScale = 1f;
            }
            Time.timeScale = timeScale;
            Debugging.Log("F2 >> " + "게임진행속도 증가 x " + timeScale);
        }
        else if (Input.GetKeyDown(KeyCode.F3))
        {
            if (!Common.isNight)
            {
                foreach (var i in GameObject.Find("Stage1").GetComponentsInChildren <SpriteRenderer>())
                {
                    i.color = new Color(i.color.r * 0.2f, i.color.g * 0.2f, i.color.b * 0.2f);
                }
                Common.isNight = true;
            }
            else
            {
                foreach (var i in GameObject.Find("Stage1").GetComponentsInChildren <SpriteRenderer>())
                {
                    i.color = new Color(i.color.r * 5f, i.color.g * 5f, i.color.b * 5f);
                }
                Common.isNight = false;
            }

            Debugging.Log("F3 >> " + Common.isNight);
        }
        else if (Input.GetKeyDown(KeyCode.F4))
        {
            Common.START_GAME();
            Debugging.Log("F4 >> " + "게임 스타트 온");
        }
        else if (Input.GetKeyDown(KeyCode.F5))
        {
            Common.HERO().GetComponent <move>().PlayingEventScene("PlayingNotebook");
            Debugging.Log("F5 >> " + "NoteBook");
        }
        else if (Input.GetKeyDown(KeyCode.F6))
        {
            Common.GetBottomPosition(Common.HERO().transform);
        }
    }
Esempio n. 15
0
 private void LogicEditing_LogicChanged(object sender, EventArgs e)
 {
     Debugging.Log("Trigger");
     Map_Load(sender, e);
 }
Esempio n. 16
0
    public void CastingSkill(int order)
    {
        if (selectedSkills[order] != null)
        {
            if (selectedSkillEnable[order])
            {
                List <GameObject> targetList = new List <GameObject>();
                switch (selectedSkills[order].applyType)
                {
                case UserSkill.ApplyType.All:
                    targetList = Common.FindAll();
                    break;

                case UserSkill.ApplyType.Allys:
                    targetList = Common.FindAlly();
                    break;

                case UserSkill.ApplyType.Enemys:
                    targetList = Common.FindEnemy();
                    break;

                case UserSkill.ApplyType.DeadAllys:
                    targetList = Common.FindDeadAlly();
                    break;
                }
                if (targetList != null && targetList.Count > 0)
                {
                    Debugging.Log(selectedSkills[order].skillName + " 시전!!");
                    if (selectedSkills[order].skillEffect != null && selectedSkills[order].skillEffect.GetComponent <ParticleSystem>() != null)
                    {
                        SoundManager.instance.EffectSourcePlay(selectedSkills[order].skillSound);
                        for (int i = 0; i < targetList.Count; i++)
                        {
                            GameObject skillEffect = Instantiate(selectedSkills[order].skillEffect, this.transform);
                            skillEffect.transform.position = targetList[i].transform.position;
                            skillEffect.SetActive(true);
                            skillEffect.GetComponent <ParticleSystem>().Play();
                        }
                    }
                    switch (selectedSkills[order].skillType)
                    {
                    case UserSkill.SkillType.ATTACK:
                        foreach (var target in targetList)
                        {
                            target.GetComponent <Hero>().HittedByObject(selectedSkills[order].skillAbillity, false, new Vector2(15, 15));
                        }
                        break;

                    case UserSkill.SkillType.HEAL:
                        foreach (var target in targetList)
                        {
                            target.GetComponent <Hero>().Healing((int)(selectedSkills[order].skillAbillity));
                        }
                        break;

                    case UserSkill.SkillType.BUFF:
                        break;

                    case UserSkill.SkillType.DEBUFF:
                        break;

                    case UserSkill.SkillType.RESURRENCTION:
                        CharactersManager.instance.ResurrectionHero(targetList[UnityEngine.Random.Range(0, targetList.Count)].GetComponent <Hero>().id);
                        break;

                    case UserSkill.SkillType.STUN:
                        foreach (var target in targetList)
                        {
                            target.GetComponent <Hero>().Stunned(2.0f, true);
                        }
                        break;
                    }
                    selectedSkillEnable[order]    = false;
                    selectedSkillDelayTime[order] = selectedSkills[order].skillDelayTime;
                }
                else
                {
                    Debugging.Log(selectedSkills[order].skillName + " 의 타겟이 존재하지 않습니다.");
                }
            }
            else
            {
                Debugging.Log(selectedSkills[order].skillName + " 의 쿨타임이 " + selectedSkillDelayTime[order] + " 초 남았습니다.");
            }
        }
    }
Esempio n. 17
0
    void Flock()
    {
        if (!isFlock)
        {
            string[]       exceptLayer = { "mapObject", "Ignore Raycast", "Item", "UI", "BackField", "InBuilding" };
            int            layerMask   = ~(LayerMask.GetMask(exceptLayer));
            RaycastHit2D[] hit         = Physics2D.CircleCastAll(transform.position, 2.0f, Vector2.up, 2.0f, layerMask);
            foreach (var i in hit)
            {
                if (i.transform.CompareTag("Player") || i.transform.CompareTag("Npc"))
                {
                    isFlock = true;
                    Enemy   = i.transform;
                    break;
                }
            }
        }
        if (isFlock && !isFind)
        {
            int            layerMask = 1 << 29;
            RaycastHit2D[] hit       = Physics2D.CircleCastAll(transform.position, CircleRangeRadius, Vector2.up, CircleRangeRadius, layerMask);
            foreach (var i in hit)
            {
                if (Vector2.Distance(i.transform.position, Enemy.transform.position) > 3)
                {
                    if ((Enemy.transform.position.x > transform.position.x && i.transform.position.x < transform.position.x) || (Enemy.transform.position.x < transform.position.x && i.transform.position.x > transform.position.x))
                    {
                        Target = i.transform;
                        Tpos   = Target.transform.position + new Vector3(Random.Range(-0.5f, 0.5f), 0);
                        isFind = true;
                        animator.SetBool("isFly", true);

                        Debugging.Log("타겟발견 : " + Target.name);
                        break;
                    }
                }
            }

            if (!isFind)
            {
                foreach (var i in hit)
                {
                    if (Vector2.Distance(i.transform.position, Enemy.transform.position) > 5)
                    {
                        Target = i.transform;
                        Tpos   = Target.transform.position + new Vector3(Random.Range(-0.5f, 0.5f), 0.1f);
                        isFind = true;
                        animator.SetBool("isFly", true);

                        Debugging.Log("타겟발견 : " + Target.name);
                        break;
                    }
                }
                isFlock = false;
            }
        }
        if (isFind)
        {
            this.transform.position = Vector3.Lerp(this.transform.position, Tpos, 0.5f * Time.deltaTime);
            if (this.transform.position.x > Target.transform.position.x)
            {
                isLeftorRight = true;
            }
            else
            {
                isLeftorRight = false;
            }

            this.transform.rotation = Quaternion.Euler(new Vector3(0, isLeftorRight ? 0 : 180, 0));
            if (Vector2.Distance(this.transform.position, Tpos) < 0.05f)
            {
                isFind  = false;
                isFlock = false;
                animator.SetBool("isFly", false);
            }
        }
    }
Esempio n. 18
0
        //Form Handeling

        private async void BTNFindPath_Click(object sender, EventArgs e)
        {
            //Find grab the ID of the last path currently in the list. TODO delete that path from the "paths" to free up junk space.
            if (LBPathFinder.Items.Count > 1)
            {
                var item = LBPathFinder.Items[1] as LogicObjects.ListItem;
                var part = item.PathPartition;
                Debugging.Log(part.ToString());
            }

            int partition = paths.Count();

            paths.Add(new List <List <LogicObjects.MapPoint> >());
            LBPathFinder.Items.Clear();

            if (!(CMBStart.SelectedItem is KeyValuePair <int, string>) || !(CMBEnd.SelectedItem is KeyValuePair <int, string>))
            {
                return;
            }
            var Startindex = Int32.Parse(CMBStart.SelectedValue.ToString());
            var DestIndex  = Int32.Parse(CMBEnd.SelectedValue.ToString());

            if (Startindex < 0 || DestIndex < 0)
            {
                return;
            }
            LBPathFinder.Items.Add("Finding Path.....");
            LBPathFinder.Items.Add("Please Wait");
            LBPathFinder.Refresh();

            bool DestinationAtStarting = await Task.Run(() => PathFinder.Calculatepath(Startindex, DestIndex, partition));

            LBPathFinder.Items.Clear();

            if (DestinationAtStarting)
            {
                foreach (var i in Utility.WrapStringInListBox(LBPathFinder, "Your destination is available from your starting area.", ""))
                {
                    LBPathFinder.Items.Add(i);
                }
                return;
            }

            if (PathFinder.paths[partition].Count == 0)
            {
                LBPathFinder.Items.Add("No Path Found!");
                LBPathFinder.Items.Add("");

                foreach (var i in Utility.WrapStringInListBox(LBPathFinder, "This path finder is still in beta and may not always work as intended.", ""))
                {
                    LBPathFinder.Items.Add(i);
                }
                LBPathFinder.Items.Add("");
                if (!LogicObjects.MainTrackerInstance.Options.UseSongOfTime)
                {
                    var sotT = "Your destination may not be reachable without song of time. The use of Song of Time is not considered by default. To enable Song of Time toggle it in the options menu";
                    foreach (var i in Utility.WrapStringInListBox(LBPathFinder, sotT, ""))
                    {
                        LBPathFinder.Items.Add(i);
                    }
                }
                LBPathFinder.Items.Add("");
                var ErrT = "If you believe this is an error try navigating to a different entrance close to your destination or try a different starting point.";
                foreach (var i in Utility.WrapStringInListBox(LBPathFinder, ErrT, ""))
                {
                    LBPathFinder.Items.Add(i);
                }

                return;
            }
            PrintPaths(-1, partition);
        }
Esempio n. 19
0
    public static Item StartSpeicalGacha(List <Item> items, int seed)
    {
        Random.InitState(seed);
        int gachaClassNumber = Random.Range(0, 1000);

        User.gachaSeed = Random.Range(0, 1000);
        GachaClass gachaClass;

        if (gachaClassNumber <= 5)
        {
            gachaClass = GachaClass.SSS;
        }
        else if (gachaClassNumber > 5 && gachaClassNumber <= 25)
        {
            gachaClass = GachaClass.SS;
        }
        else if (gachaClassNumber > 25 && gachaClassNumber <= 170)
        {
            gachaClass = GachaClass.S;
        }
        else if (gachaClassNumber > 150 && gachaClassNumber <= 350)
        {
            gachaClass = GachaClass.A;
        }
        else
        {
            gachaClass = GachaClass.B;
        }
        List <Item> gachaItemList   = new List <Item>();
        Item        returnGachaItem = null;

        switch (gachaClass)
        {
        case GachaClass.SSS:
            gachaItemList   = items.FindAll(x => x.itemClass == 7);
            returnGachaItem = gachaItemList[Random.Range(0, gachaItemList.Count)];
            break;

        case GachaClass.SS:
            gachaItemList   = items.FindAll(x => x.itemClass == 6);
            returnGachaItem = gachaItemList[Random.Range(0, gachaItemList.Count)];
            break;

        case GachaClass.S:
            gachaItemList   = items.FindAll(x => x.itemClass == 5);
            returnGachaItem = gachaItemList[Random.Range(0, gachaItemList.Count)];
            break;

        case GachaClass.A:
            gachaItemList   = items.FindAll(x => x.itemClass == 4);
            returnGachaItem = gachaItemList[Random.Range(0, gachaItemList.Count)];
            break;

        case GachaClass.B:
            gachaItemList   = items.FindAll(x => x.itemClass == 3);
            returnGachaItem = gachaItemList[Random.Range(0, gachaItemList.Count)];
            break;
        }
        if (returnGachaItem != null)
        {
            ItemSystem.SetObtainItem(returnGachaItem.id);
        }

        Debugging.Log(returnGachaItem.name + " 아이템이 랜덤으로 뽑힘");
        return(returnGachaItem);
    }
Esempio n. 20
0
 IEnumerator ChatAblePop()
 {
     Debugging.Log(string.Format("\'{0}\'와 대화가능 상태", name));
     yield return(null);
 }
Esempio n. 21
0
        private void BtnCheckSeed_Click(object sender, EventArgs e)
        {
            if (!chkShowObtainable.Checked && !chkShowUnobtainable.Checked)
            {
                LBResult.Items.Clear();
                return;
            }

            var logicCopy = Utility.CloneTrackerInstance(CheckerInstance);

            foreach (var entry in logicCopy.Logic)
            {
                entry.Available = false;
                entry.Checked   = false;
                entry.Aquired   = false;
                if (entry.SpoilerRandom > -1)
                {
                    entry.RandomizedItem = entry.SpoilerRandom;
                }                                                                            //Make the items randomized item its spoiler item, just for consitancy sake
                else if (entry.RandomizedItem > -1)
                {
                    entry.SpoilerRandom = entry.RandomizedItem;
                }                                                                                  //If the item doesn't have spoiler data, but does have a randomized item. set it's spoiler data to the randomized item
                else if (entry.Unrandomized(2))
                {
                    entry.SpoilerRandom = entry.ID; entry.RandomizedItem = entry.ID;
                }                                                                                                   //If the item doesn't have spoiler data or a randomized item and is unrandomized (manual), set it's spoiler item to it's self
            }

            LBResult.Items.Clear();
            List <int> Ignored = new List <int>();

            foreach (var item in LBIgnoredChecks.Items)
            {
                Ignored.Add((item as LogicObjects.ListItem).PathID);
            }

            var GameClearEntry = logicCopy.Logic.Find(x => x.DictionaryName == "MMRTGameClear");

            if (GameClearEntry != null)
            {
                GameClearEntry.ItemName = (LogicObjects.MainTrackerInstance.IsMM()) ? "Defeat Majora" : "Beat the Game";
            }
            else if (LogicObjects.MainTrackerInstance.IsMM())
            {
                int GameClearID = PlaythroughGenerator.GetGameClearEntry(logicCopy.Logic, LogicObjects.MainTrackerInstance.IsEntranceRando());
                logicCopy.Logic[GameClearID].ItemName = "Defeat Majora";
            }

            CheckSeed(logicCopy, true, Ignored);
            List <string> obtainable   = new List <string>();
            List <string> unobtainable = new List <string>();

            foreach (var item in LBNeededItems.Items)
            {
                bool   Spoil           = false;
                var    ListItem        = item as LogicObjects.ListItem;
                var    iteminLogic     = logicCopy.Logic[ListItem.PathID];
                string ItemName        = iteminLogic.ItemName ?? iteminLogic.DictionaryName;
                var    ItemsLocation   = iteminLogic.GetItemsNewLocation(logicCopy.Logic);
                string LocationFoundAt = (ItemsLocation != null) ? ItemsLocation.LocationName ?? ItemsLocation.DictionaryName : "";
                string DisplayName     = (Spoil) ? ItemName + ": " + LocationFoundAt : ItemName;

                Debugging.Log(logicCopy.Logic[ListItem.PathID].DictionaryName + " " + logicCopy.Logic[ListItem.PathID].Aquired);
                if (logicCopy.Logic[ListItem.PathID].Aquired)
                {
                    obtainable.Add(DisplayName);
                }
                else
                {
                    unobtainable.Add(DisplayName);
                }
            }
            if (unobtainable.Count > 0 && chkShowUnobtainable.Checked)
            {
                LBResult.Items.Add("Unobtainable ==============================");
                foreach (var i in unobtainable)
                {
                    LBResult.Items.Add(i);
                }
            }
            if (obtainable.Count > 0 && chkShowObtainable.Checked)
            {
                LBResult.Items.Add("Obtainable ==============================");
                foreach (var i in obtainable)
                {
                    LBResult.Items.Add(i);
                }
            }
        }
Esempio n. 22
0
        private async Task HandleCommandAsync(SocketMessage arg)
        {
            MessageHandler  handler = new MessageHandler();
            RestUserMessage message1;
            var             message = arg as SocketUserMessage;

            if (message == null || message.Author.IsBot)
            {
                return;
            }

            int argPos = 0;

            if (!message.HasStringPrefix("//", ref argPos) && message.Channel.Name == "ticket-station")
            {
                await message.DeleteAsync();
            }
            if ((message.HasStringPrefix("//", ref argPos) || message.HasMentionPrefix(Settings._client.CurrentUser, ref argPos)) && !CheckPrivate(message))
            {
                var context = new SocketCommandContext(Settings._client, message);


                Debugging.Log("Command Handler", $"{context.User.Username} called {message}");

                var result = await Settings._commands.ExecuteAsync(context, argPos, Settings._services);

                if (!result.IsSuccess && result.Error != CommandError.ObjectNotFound || result.Error != CommandError.Exception || result.ErrorReason != "The server responded with error 400: BadRequest")
                {
                    Debugging.Log("Command Handler", $"Error with command {message}: {result.ErrorReason.Replace(".", "")}", LogSeverity.Warning);

                    if (result.ErrorReason == "Invalid context for command; accepted contexts: DM")
                    {
                        await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed(":no_entry_sign:  ERROR!", "Try PMing that command instead.").Build());
                    }
                    else
                    {
                        message1 = await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed(":no_entry_sign:  Error!", result.ErrorReason).Build());

                        await Task.Delay(5000);

                        await message1.DeleteAsync();

                        await message.DeleteAsync();
                    }
                }
            }

            else if (CheckPrivate(message)) //direct message
            {
                bool AddingToDB = false;
                var  context    = new SocketCommandContext(Settings._client, message);
                Debugging.Log("Command Handler, DM", $"{context.User.Username} sent {message}");

                var result = await Settings._commands.ExecuteAsync(context, argPos, Settings._services);

                if (!result.IsSuccess && result.Error != CommandError.ObjectNotFound || result.Error != CommandError.Exception)
                {
                    if (AddingToDB)
                    {
                        AddingToDB = false;
                    }
                    else
                    {
                        Debugging.Log("Command Handler, DM", $"Error with command {message}: {result.ErrorReason.Replace(".", "")}", LogSeverity.Warning);
                        await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed(":no_entry_sign:  Error!", result.ErrorReason).Build());
                    }
                }
            }
        }
Esempio n. 23
0
        private async Task HandleCommandAsync(SocketMessage arg)
        {
            MessageHandler handler = new MessageHandler();

            var message = arg as SocketUserMessage;

            if (message == null || message.Author.IsBot)
            {
                return;
            }

            int argPos = 0;

            if ((message.HasStringPrefix("!", ref argPos) || message.HasMentionPrefix(Settings._client.CurrentUser, ref argPos)) && !CheckPrivate(message))
            {
                var context = new SocketCommandContext(Settings._client, message);
                Debugging.Log("Command Handler", $"{context.User.Username} called {message}");

                var result = await Settings._commands.ExecuteAsync(context, argPos, Settings._services);

                if (!result.IsSuccess && result.Error != CommandError.ObjectNotFound || result.Error != CommandError.Exception || result.ErrorReason != "The server responded with error 400: BadRequest")
                {
                    Debugging.Log("Command Handler", $"Error with command {message}: {result.ErrorReason.Replace(".", "")}", LogSeverity.Warning);

                    if (result.ErrorReason == "Invalid context for command; accepted contexts: DM")
                    {
                        await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed(":no_entry_sign:  Whoops! Something went wrong!", "Try messaging that command to me instead!").Build());
                    }
                    else
                    {
                        await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed(":no_entry_sign:  Whoops! Something went wrong!", result.ErrorReason).Build());
                    }
                }
            }
            else if (CheckPrivate(message)) //direct message
            {
                bool AddingToDB = false;
                var  context    = new SocketCommandContext(Settings._client, message);
                Debugging.Log("Command Handler, DM", $"{context.User.Username} sent {message}");

                if (!CheckUserInDatabase.Check(context.User.Id.ToString())) // checks if user is in database, if not, add
                {
                    AddingToDB = true;
                    await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed("Hi there!", "Looks like we've never met before. Nice to meet you! I'm going to quickly add you to my database...", ImageHandler.GetImageUrl("ahriwave")).Build());

                    User newUser = new User(context.User.Id.ToString(), context.User.Username);
                    if (newUser.AddToDatabase())
                    {
                        await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed("All done!", "You're ready to go! Use `help` to see what I can do!"));
                    }
                    else
                    {
                        await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed("Hmm... Something went wrong!", "I couldn't add you to my database. Go ahead and try again!"));
                    }
                }

                var result = await Settings._commands.ExecuteAsync(context, argPos, Settings._services);

                if (!result.IsSuccess && result.Error != CommandError.ObjectNotFound || result.Error != CommandError.Exception)
                {
                    if (AddingToDB)
                    {
                        AddingToDB = false;
                    }
                    else
                    {
                        Debugging.Log("Command Handler, DM", $"Error with command {message}: {result.ErrorReason.Replace(".", "")}", LogSeverity.Warning);
                        await arg.Channel.SendMessageAsync("", false, handler.BuildEmbed(":no_entry_sign:  Whoops! Something went wrong!", result.ErrorReason).Build());
                    }
                }
            }
        }
Esempio n. 24
0
 public void SetSkill(UserSkill userSkill, int skillNumber)
 {
     Debugging.Log(userSkill.name);
     selectedSkillDelayTime[skillNumber] = 10f;
     selectedSkillEnable[skillNumber]    = false;
 }
Esempio n. 25
0
        public static void CleanMultiWorldData(LogicObjects.TrackerInstance Instance, LogicObjects.MMRTpacket Data)
        {
            foreach (var i in Instance.Logic.Where(x => x.Aquired && x.PlayerData.ItemCameFromPlayer == Data.PlayerID))
            {
                i.Aquired = false;
                i.PlayerData.ItemCameFromPlayer = -1;
            }

            var log          = LogicObjects.MainTrackerInstance.Logic;
            var itemsAquired = new List <LogicObjects.LogicEntry>();
            var itemsInUse   = new List <LogicObjects.LogicEntry>();

            foreach (var i in log)
            {
                if (i.IsFake)
                {
                    continue;
                }
                if (i.LogicItemAquired())
                {
                    itemsAquired.Add(i); itemsInUse.Add(i);
                }
                if (i.ItemHasBeenPlaced(Instance.Logic))
                {
                    itemsInUse.Add(i);
                }
            }

            foreach (var i in Data.LogicData)
            {
                if (i.PI != LogicObjects.MainTrackerInstance.Options.MyPlayerID || i.Ch == false || !Instance.ItemInRange(i.RI) || log[i.RI].IsEntrance())
                {
                    continue;
                }

                if (itemsInUse.Where(x => x.ID == i.RI).Any())
                {
                    Debugging.Log($"{log[i.RI].DictionaryName} was in use elsewhere");

                    var MatchingItems             = log.Where(x => x.SpoilerItem.Intersect(log[i.RI].SpoilerItem).Any());
                    var FindUnusedMatchingItem    = MatchingItems.Where(x => !itemsInUse.Where(y => y.ID == x.ID).Any());
                    var FindUnAquiredMatchingItem = MatchingItems.Where(x => !itemsAquired.Where(y => y.ID == x.ID).Any());

                    if (FindUnusedMatchingItem.Any())
                    {
                        Debugging.Log($"Unused Matching Item found: {FindUnusedMatchingItem.ToArray()[0].DictionaryName}");
                        var newItem = FindUnusedMatchingItem.First();
                        i.RI = newItem.ID;
                        itemsAquired.Add(newItem);
                        itemsInUse.Add(newItem);
                    }
                    else if (FindUnAquiredMatchingItem.Any())
                    {
                        Debugging.Log($"No Unused Matching Items Were Found, getting unaquired matching item.");
                        Debugging.Log($"Matching UnAquired Item Found: {FindUnAquiredMatchingItem.First().DictionaryName}");
                        var newItem = FindUnAquiredMatchingItem.First();
                        i.RI = newItem.ID;
                        itemsAquired.Add(newItem);
                        itemsInUse.Add(newItem);
                    }
                    else
                    {
                        Debugging.Log($"No Unused items were found. This is an error and could cause Issues.");
                    }
                }
            }
        }
Esempio n. 26
0
 public IEnumerator ShowSelectMap()
 {
     while (ContentView.transform.childCount < MapSystem.GetMapCount())
     {
         Debugging.Log("로딩........");
         yield return(null);
     }
     currentMapId    = MapSystem.GetCurrentAllMapId();
     currentMapIndex = GetMapIndex(currentMapId);
     Debugging.Log(currentMapIndex + "번째 인덱스가 현재 맵입니다.");
     for (int i = 0; i < ContentView.transform.childCount; i++)
     {
         int tempEventIndex = i;
         if (i == currentMapIndex)
         {
             mapNodeImage = ContentView.transform.GetChild(i).GetComponent <Image>();
             ShowMapInfo(GetMapId(i));
             if (hero == null)
             {
                 hero = Instantiate(PrefabsDatabaseManager.instance.GetHeroPrefab(101), mapNodeImage.transform);
                 if (hero.GetComponent <Hero>() != null)
                 {
                     DestroyImmediate(hero.GetComponent <Hero>());
                 }
                 if (hero.GetComponent <Rigidbody2D>() != null)
                 {
                     DestroyImmediate(hero.GetComponent <Rigidbody2D>());
                 }
                 foreach (var sp in hero.GetComponentsInChildren <SpriteRenderer>())
                 {
                     sp.sortingLayerName = "ShowObject";
                     sp.gameObject.layer = 16;
                 }
                 hero.transform.localRotation = Quaternion.Euler(0, 180, 0);
                 hero.GetComponent <Animator>().SetBool("isMoving", true);
                 hero.GetComponent <Animator>().SetBool("isRun", true);
             }
             this.GetComponentInChildren <SimpleScrollSnap>().GoToPanel(tempEventIndex);
             ShowHero();
         }
         ContentView.transform.GetChild(i).GetComponent <Button>().onClick.RemoveAllListeners();
         ContentView.transform.GetChild(i).GetComponent <Button>().onClick.AddListener(delegate
         {
             OnMapNodeClick(MapSystem.GetMap(GetMapId(tempEventIndex)).id, tempEventIndex);
         });
         if (!MapSystem.isAbleMap(MapSystem.GetMap(GetMapId(i)).id))
         {
             ContentView.transform.GetChild(i).transform.GetChild(0).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("UI/ui_lock_transparent");
         }
         else
         {
             if (MapSystem.GetMap(GetMapId(i)).clearPoint < 1)
             {
                 ContentView.transform.GetChild(i).transform.GetChild(0).GetComponent <Image>().color = new Color(1, 1, 1, 0);
             }
             else
             {
                 ContentView.transform.GetChild(i).transform.GetChild(0).GetComponent <Image>().color = new Color(1, 1, 1, 1);
             }
         }
     }
 }
Esempio n. 27
0
        public static void LoadMainLogicPreset(string Path, string WebPath, object sender, EventArgs e, string WebDicOverride, bool New = true)
        {
            Console.WriteLine(WebDicOverride + "Was Dic");
            try
            {
                if (!Tools.PromptSave(LogicObjects.MainTrackerInstance))
                {
                    return;
                }
                string[] Lines = null;
                if (File.Exists(Path))
                {
                    Lines = File.ReadAllLines(Path);
                    Debugging.Log(Path);
                }
                else
                {
                    System.Net.WebClient wc = new System.Net.WebClient();
                    string webData          = wc.DownloadString(WebPath);
                    Lines = webData.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
                    Debugging.Log(WebPath);
                }

                List <LogicObjects.LogicDictionaryEntry> DicOverride = null;
                if (WebDicOverride != "")
                {
                    try
                    {
                        System.Net.WebClient wc = new System.Net.WebClient();
                        string webData          = wc.DownloadString(WebDicOverride);
                        var    DicLines         = webData.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
                        var    csv = Utility.ConvertCsvFileToJsonObject(DicLines);
                        DicOverride = JsonConvert.DeserializeObject <List <LogicObjects.LogicDictionaryEntry> >(csv);
                        Debugging.Log(WebDicOverride);
                    }
                    catch (Exception j)
                    {
                        Console.WriteLine("Dictionary Invalid");
                        DicOverride = null;
                    }
                }
                if (New)
                {
                    LogicObjects.MainTrackerInstance = new LogicObjects.TrackerInstance();
                    LogicObjects.MainTrackerInstance.LogicDictionary = DicOverride;
                    Tools.CreateTrackerInstance(LogicObjects.MainTrackerInstance, Lines.ToArray());
                }
                else
                {
                    LogicObjects.MainTrackerInstance.LogicDictionary = DicOverride;
                    LogicEditing.RecreateLogic(LogicObjects.MainTrackerInstance, Lines);
                }
                MainInterface.CurrentProgram.FormatMenuItems();
                MainInterface.CurrentProgram.ResizeObject();
                MainInterface.CurrentProgram.PrintToListBox();
                MainInterface.FireEvents(sender, e);
                Tools.UpdateTrackerTitle();
            }
            catch
            {
                MessageBox.Show("Preset File Invalid! If you have not tampered with the preset files in \"Recources\\Other Files\\\" Please report this issue. Otherwise, redownload or delete those files.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 28
0
        public async Task View()
        {
            MessageHandler messageHandler = new MessageHandler();
            EmbedBuilder   message;
            EmbedBuilder   embed = new EmbedBuilder()
                                   .WithAuthor(a => a.WithIconUrl(Context.User.GetAvatarUrl()).WithName(Context.User.Username + "'s team"))
                                   .WithTitle("Here's your lineup!")
                                   .WithColor(Palette.Pink);

            if (CheckStarted(Context.User.Id.ToString()))
            {
                string savedMessage = "";
                var    user         = GetUserByIdFromList(Context.User.Id.ToString());

                if (user.Saved)
                {
                    savedMessage = "Your team is currently saved! Don't worry!";
                }
                else
                {
                    savedMessage = "Team isn't currently saved! Use `team save` when you're done!";
                }

                var summonersInUserTeam         = GetNamesForSummonersInUserTeam(GetUserByIdFromList(Context.User.Id.ToString()));
                var namesForChampionsInUserTeam = GetNamesForChampionsInUserTeam(GetUserByIdFromList(Context.User.Id.ToString()));

                if (summonersInUserTeam.Count > 1)
                {
                    message = messageHandler.BuildEmbed("Your current team setup: ", savedMessage, Palette.Pink, summonersInUserTeam, namesForChampionsInUserTeam);
                }
                else
                {
                    message = messageHandler.BuildEmbed("Your current team setup: ", savedMessage, Palette.Pink, new List <string> {
                        "It's empty!"
                    }, new List <string> {
                        "See `help` to see how to add"
                    });
                }
            }
            else
            {
                try
                {
                    string userid = Context.User.Id.ToString();

                    User user = new User(userid, Context.User.Username);

                    Team team = new Team(userid);
                    team.GetExistingTeamFromUser();


                    user.SetTeam(team);

                    int counter = 0;
                    foreach (var summoner in team.Summoners)
                    {
                        counter++;
                        string role;
                        string incrementor;
                        switch (summoner.Lane)
                        {
                        case (Lane.Bot): role = "ADC"; break;

                        case (Lane.Jungle): role = "Jungler"; break;

                        case (Lane.Mid): role = "Midlaner"; break;

                        case (Lane.Top): role = "Top"; break;

                        case (Lane.Support): role = "Support"; break;

                        default: return;
                        }
                        switch (counter)
                        {
                        case 1: incrementor = "Alright! First up we've got: "; break;

                        case 2: incrementor = "Secondly, it's: "; break;

                        case 3: incrementor = "Next up!: "; break;

                        case 4: incrementor = "Let's not forget about "; break;

                        case 5: incrementor = "And last, but not least! It's "; break;

                        default: return;
                        }
                        long id = int.Parse(summoner.SummonerId);
                        embed.AddField(incrementor + RiotApi.GetDevelopmentInstance(Settings.RiotAPIKey).GetSummonerBySummonerId(summoner.Region, id).Name + " as SK" + Context.User.Username.ToUpperInvariant() + "'s " + role + "!", "Looks like they'll be playing... " + GetChampionNameById(summoner.ChampionId).Name + "!");
                    }
                }
                catch (Exception e)
                {
                    message = messageHandler.BuildEmbed("Whoops! There's been an error getting your team. Make sure you have one!", $"A message for my creators: {e.Message}", Palette.Pink);
                    Debugging.Log("View command CHECKSTARTED ELSE", $"Error trying to get existing team from user: {e.Message}", LogSeverity.Error);
                }
            }

            await ReplyAsync("", false, embed.Build());
        }
Esempio n. 29
0
 private static void Initialized(object sender, EventArgs e)
 {
     Debugging.DrawBounds = true;
     Debugging.Log(LogEntryType.Info, "Starting GameUpdater...");
     GameUpdater.Start();
 }
Esempio n. 30
0
 public void OnMapSelectCompletedClick()
 {
     GameManagement.instance.SetStageInfo(currentMapId);
     Debugging.Log(currentMapId + " 의 맵 선택완료.");
 }