Example #1
0
        public void GetExpV2(long waveExp, bool log = false)
        {
            if (!characterLevelSheet.TryGetLevel(Exp.Current + waveExp, out var newLevel))
            {
                waveExp  = Exp.Max - Exp.Current - 1;
                newLevel = Level;
            }

            Exp.Current += waveExp;

            if (log)
            {
                var getExp = new GetExp((CharacterBase)Clone(), waveExp);
                Simulator.Log.Add(getExp);
            }

            if (Level == newLevel)
            {
                return;
            }

            Level = newLevel;
            if (Level < newLevel)
            {
                eventMap?.Add(new KeyValuePair <int, int>((int)QuestEventType.Level, newLevel - Level));
            }

            UpdateExp();
        }
Example #2
0
        public void GetExp(long waveExp, bool log = false)
        {
            Exp.Current += waveExp;

            if (log)
            {
                var getExp = new GetExp((CharacterBase)Clone(), waveExp);
                Simulator.Log.Add(getExp);
            }

            if (Exp.Current < Exp.Max)
            {
                return;
            }

            var level = Level;

            Level = characterLevelSheet.GetLevel(Exp.Current);
            // UI에서 레벨업 처리시 NRE 회피
            if (level < Level)
            {
                eventMap?.Add(new KeyValuePair <int, int>((int)QuestEventType.Level, Level - level));
            }

            UpdateExp();
        }
    public void AddAloneBattleBillboard(Vector3 pos, int num, AloneBattleBillboardType type)
    {
        //return; //By MaiFeo
        AloneBattleBillboard ab = null;

        switch (type)
        {
        case AloneBattleBillboardType.Exp:
            LoggerHelper.Debug("---------Get Exp" + num);
            ab = new GetExp(num);
            break;

        case AloneBattleBillboardType.Gold:
        default:
            LoggerHelper.Debug("---------Get Gold" + num);
            ab = new GetGold(num);
            break;
        }

        ab.SetBillboardPos(pos);
    }
Example #4
0
    IEnumerator SaveDataAfter()
    {
        PostAfterData AfterData = new PostAfterData();

        AfterData.characterId = events.characterId;
        AfterData.status      = events.status;

        List <int> AQ_list = events.idOfAnsweredQns;
        string     AQ      = "";

        for (int j = 0; j < AQ_list.Count - 1; j++)
        {
            AQ += AQ_list[j].ToString() + ",";
        }
        AQ += AQ_list[AQ_list.Count - 1].ToString();
        AQ  = "[" + AQ + "]";

        List <int> CA_list = events.idOfCorrectlyAnsweredQns;
        string     CA      = "";

        if (CA_list.Count > 0)
        {
            for (int j = 0; j < CA_list.Count - 1; j++)
            {
                CA += CA_list[j].ToString() + ",";
            }
            CA += CA_list[CA_list.Count - 1].ToString();
            CA  = "[" + CA + "]";
        }

        AfterData.numOfQnsAnswered         = events.numOfQnsAnswered;
        AfterData.idOfAnsweredQns          = AQ;
        AfterData.idOfCorrectlyAnsweredQns = CA;


        //test

        /*AfterData.characterId = 1;
         * AfterData.status = "failed";
         * AfterData.numOfQnsAnswered = 5;
         * AfterData.idOfAnsweredQns = "[3,4,1,19,20]";
         * AfterData.idOfCorrectlyAnsweredQns = "[3,4,1,19]";
         * ;
         *
         * ";*/

        string json = JsonUtility.ToJson(AfterData);

        Debug.Log(json);

        string url = "localhost:9090/api/combat/1/end";
        //string url = "localhost:9090/api/combat/"+events.combatID+"/end";



        UnityWebRequest userRequest = UnityWebRequest.Post(url, json);

        userRequest.uploadHandler.contentType = "application/json";
        userRequest.uploadHandler             = new UploadHandlerRaw(System.Text.Encoding.UTF8.GetBytes(json));
        userRequest.SetRequestHeader("Accept", "application/json");
        userRequest.SetRequestHeader("Content-Type", "application/json");

        //Debug.Log(json);

        yield return(userRequest.SendWebRequest());


        if (userRequest.isNetworkError || userRequest.isHttpError)
        {
            Debug.LogError(userRequest.error);
            yield break;
        }
        else
        {
            Debug.Log(userRequest.downloadHandler.text);
            JSONNode StartBattleInfo = JSON.Parse(userRequest.downloadHandler.text);

            string StartBattleString = StartBattleInfo.ToString();
            GetExp e = JsonUtility.FromJson <GetExp>(StartBattleString);
            uIElements.ResolutionScoreText.text = "Totol EXP: " + e.addedExp;
            //StartCoroutine(CalculateScore(e.addedExp));
        }
    }
    public void AddAloneBattleBillboard(Vector3 pos, int num, AloneBattleBillboardType type)
    {
        //return; //By MaiFeo
        AloneBattleBillboard ab = null;

        switch (type)
        {
            case AloneBattleBillboardType.Exp:
                LoggerHelper.Debug("---------Get Exp" + num);
                ab = new GetExp(num);
                break;

            case AloneBattleBillboardType.Gold:
            default:
                LoggerHelper.Debug("---------Get Gold" + num);
                ab = new GetGold(num);
                break;
        }

        ab.SetBillboardPos(pos);
    }