Exemplo n.º 1
0
    // Start is called before the first frame update
    private IEnumerator Init()
    {
        JobData.Load();
        SkillData.Load();
        EnemyData.Load();
        BattleTileData.Load();
        BattlefieldData.Load();
        BattleGroupData.Load();
        BattleStatusData.Load();
        ItemData.Load();
        EquipData.Load();
        ItemEffectData.Load();
        LanguageData.Load();
        DungeonData.Load();
        RoomData.Load();
        TreasureData.Load();
        ConversationData.Load();
        ShopData.Load();
        DungeonGroupData.Load();
        ExpData.Load();
        NewCookData.Load();

        yield return(new WaitForEndOfFrame());

        InitManager();

        MySceneManager.Instance.Load();

#if UNITY_EDITOR
        DebugCommand.Start();
#endif
    }
Exemplo n.º 2
0
    public void UpdateInfo()
    {
        hpLabel.text = ((int)GamePlayer.Instance.Properties[(int)PropertyType.PT_HpCurr]) + "/" + ((int)GamePlayer.Instance.Properties[(int)PropertyType.PT_HpMax]);
        mpLabel.text = ((int)GamePlayer.Instance.Properties[(int)PropertyType.PT_MpCurr]) + "/" + ((int)GamePlayer.Instance.Properties[(int)PropertyType.PT_MpMax]);
        curExp       = (long)playerInst.Properties[(int)PropertyType.PT_Exp];
        pcurExp      = playerInst.Properties[(int)PropertyType.PT_Exp];
        int  l = playerInst.GetIprop(PropertyType.PT_Level);
        long m = ExpData.GetPlayerMaxExp(l);

        maxExp = ExpData.GetPlayerMaxExp(playerInst.GetIprop(PropertyType.PT_Level));
        chucunExpLable.text = GamePlayer.Instance.GetIprop(PropertyType.PT_ConvertExp).ToString();
        if (playerInst.GetIprop(PropertyType.PT_Level) > 1)
        {
            oldLevel = (playerInst.GetIprop(PropertyType.PT_Level) - 1);
        }
        else
        {
            oldExp = 0;
        }
        oldExp = ExpData.GetPlayerMaxExp(oldLevel);
        long s = curExp - oldExp;

        if (s < 0)
        {
            s = 0;
        }
        expSlider.value = (s * 1f) / ((maxExp - oldExp) * 1f);
        expLabel.text   = s + "/" + ((long)maxExp - (long)oldExp);
    }
Exemplo n.º 3
0
        void CheckDataType(string Name)
        {
            if (tdc.CheckName(Name))              //简单输出显示 变量的值
            {
                CalData datatemp;
                try {
                    datatemp = tdc.GetData(Name).GetCalData();
                } catch (AssignedError e) {
                    PushToShow(e.Message);
                    return;
                }

                switch (datatemp.CalType)
                {
                case DataType.BLOCK:
                {
                    BlockData bd = (BlockData)datatemp;
                    PushToShow(bd.ToString());
                }
                break;

                case DataType.EXP:
                {
                    ExpData ed = (ExpData)datatemp;
                    try {
                        PushToShow(ed.ToString());
                    } catch (ExpError e) {
                        PushToShow(e.Message);
                    }
                    break;
                }

                case DataType.MATRIX:
                {
                    Matrix matrix = (Matrix)datatemp;
                    PushToShow(matrix.ToString());
                }
                break;

                case DataType.FUNC:
                {
                    FuncData fd = (FuncData)datatemp;
                    PushToShow(fd.ToString());
                }
                break;
                }
            }
            else
            {
                var str = SimpleCal(InputData);
                if (str == null)
                {
                    PushToShow("No result");
                }
                else
                {
                    PushToShow(str.ToString());
                }
            }
        }
Exemplo n.º 4
0
    public static void ParseData(string content, string fileName)
    {
        metaData = new Dictionary <int, ExpData> ();

        CSVParser parser = new CSVParser();

        if (!parser.Parse(content))
        {
            ClientLog.Instance.LogError("ExpData" + ConfigLoader.Instance.csvext + "解析错误");
            return;
        }

        int     recordCounter = parser.GetRecordCounter();
        ExpData data          = null;

        for (int i = 0; i < recordCounter; ++i)
        {
            data        = new ExpData();
            data.level_ = parser.GetInt(i, "Lv");
            string str = parser.GetString(i, "Exp");
            data.exp_ = long.Parse(str);
            string s = parser.GetString(i, "PetExp");
            data.petExp_ = long.Parse(s);

            if (metaData.ContainsKey(data.level_))
            {
                ClientLog.Instance.LogError("ExpData" + ConfigLoader.Instance.csvext + "ID重复");
                return;
            }
            metaData[data.level_] = data;
        }
        parser.Dispose();
        parser = null;
    }
Exemplo n.º 5
0
    void SetPlayerInfo()
    {
        //TitleLabel.text = "";
        //RaceLabel.text = PlayerData.GetData(playerInst.Properties [(int)PropertyType.PT_TableId]).Race_;
        GradeLabel.text = /*Grade.ToString()*/ playerInst.Properties [(int)PropertyType.PT_Level].ToString();
        //PrestigeLabel.text = /*Prestige.ToString()*/ playerInst.Properties [(int)PropertyType.PT_Reputation].ToString();
        RecordLabel.text = playerInst.InstId.ToString();
        string guildName = "";

        if (GuildSystem.Mguild != null)
        {
            guildName = GuildSystem.Mguild.guildName_;
        }
        else
        {
            guildName = LanguageManager.instance.GetValue("wu");
        }
        FamilyLabel.text     = guildName;
        OccupationLable.text = /*Occupation*/ Profession.get((JobType)GamePlayer.Instance.GetIprop(PropertyType.PT_Profession), GamePlayer.Instance.GetIprop(PropertyType.PT_ProfessionLevel)).jobName_;

//		HpSlider.value = playerInst.Properties [(int)PropertyType.PT_HpCurr]/playerInst.Properties [(int)PropertyType.PT_HpMax];
//		MoliSlider.value = playerInst.Properties [(int)PropertyType.PT_MpCurr]/playerInst.Properties [(int)PropertyType.PT_MpMax];

        RaceLabel.text    = LanguageManager.instance.GetValue(PlayerData.GetData(playerInst.GetIprop(PropertyType.PT_TableId)).Race_.ToString());
        curExp            = (long)playerInst.Properties[(int)PropertyType.PT_Exp];
        pcurExp           = playerInst.Properties[(int)PropertyType.PT_Exp];
        maxExp            = ExpData.GetPlayerMaxExp(playerInst.GetIprop(PropertyType.PT_Level));
        expSlider.value   = (pcurExp / maxExp) * 1f;
        LandSlider.value  = /*LandValue/10f*/ playerInst.Properties [(int)PropertyType.PT_Land] / 10f;
        waterSlider.value = /*waterValue/10f*/ playerInst.Properties [(int)PropertyType.PT_Water] / 10f;
        fireSlider.value  = /*fireValue/10f*/ playerInst.Properties [(int)PropertyType.PT_Fire] / 10f;
        windSlider.value  = /*windValue/10f*/ playerInst.Properties [(int)PropertyType.PT_Wind] / 10f;
    }
Exemplo n.º 6
0
        public void Init()
        {
            CharacterData = new CharacterData(GetPath(Path.Combine("Character", "CharacterConfig")));
            _log.Info("Loaded CharacterConfig...");

            ItemsData = new ItemsData(GetPath(Path.Combine("Game", "ItemList.bin")));
            _log.Info("Loaded {0} items.", ItemsData.Count);

            MnData = new MnData(GetPath(Path.Combine("Game", "MN.bin")));
            _log.Info("Loaded {0} monster names.", MnData.Count);

            NpcData = new NpcData(GetPath("Npcs", false));
            _log.Info("Loaded {0} npcs.", NpcData.Count);

            MobData = new MobData(GetPath("Mobs", false));
            _log.Info("Loaded {0} mobs.", MobData.Count);

            QuestData = new QuestData(GetPath(Path.Combine("Game", "Quest.bin")));
            _log.Info("Loaded {0} quests.", QuestData.Count);

            SkillData = new SkillDataData(GetPath(Path.Combine("Game", "SkillData.bin")));
            _log.Info("Loaded {0} skills.", SkillData.Count);

            using (var connection = DatabaseManager.Instance.GetConnection())
            {
                ConvertCoreData = new ConvertCoreData(connection);
                _log.Info("Loaded {0} core converts.", ConvertCoreData.Count);

                GearCoresData = new GearCoresData(connection);
                _log.Info("Loaded {0} core upgrades.", GearCoresData.Count);

                ExpData = new ExpData(connection);
                _log.Info("Loaded {0} levels.", ExpData.Count);

                PranExpData = new ExpData(connection, true);
                _log.Info("Loaded {0} pran levels.", PranExpData.Count);

                MakeItemsData = new MakeItemsData(connection);
                _log.Info("Loaded {0} make items.", MakeItemsData.Count);

                MapsData = new MapsData(connection);
                _log.Info("Loaded {0} maps.", MapsData.Count);

                RecipesData = new RecipesData(connection);
                _log.Info("Loaded {0} recipes.", RecipesData.Count);

                ReinforceAData = new ReinforceAData(connection);
                ReinforceWData = new ReinforceWData(connection);
                _log.Info("Loaded {0} reinforce values.", ReinforceAData.Count + ReinforceWData.Count);

                SetsData = new SetsData(connection);
                _log.Info("Loaded {0} sets.", SetsData.Count);

                TitlesData = new TitlesData(connection);
                _log.Info("Loaded {0} titles.", TitlesData.Count);
            }
        }
    private void GenerateData()
    {
        PlayerExpDatas = new Dictionary <int, ExpData>();

        foreach (var playerExpExcelData in PlayerExpExcelDatas)
        {
            var playerExpData = new ExpData(playerExpExcelData);
            PlayerExpDatas.Add(playerExpData.Level, playerExpData);
        }
    }
    private void GenerateData()
    {
        InGameExpDatas = new Dictionary <int, ExpData>();

        foreach (var inGameExpExcelData in InGameExpExcelDatas)
        {
            var inGameExpData = new ExpData(inGameExpExcelData);
            InGameExpDatas.Add(inGameExpData.Level, inGameExpData);
        }
    }
Exemplo n.º 9
0
        public Matrix ConvertToMatrix()
        {
            string tempExpress = strExpress.Substring(1, strExpress.Length - 2);

            string[] rows     = tempExpress.Split(';');
            string[] firstRow = rows[0].Trim().Split(new char[] { ' ', ',' });
            int      col      = 0;

            for (int i = 0; i < firstRow.Length; i++)
            {
                if (string.IsNullOrEmpty(firstRow[i]))
                {
                }
                else
                {
                    col++;
                }
            }
            int row = rows.Length;

            double[,] data = new double[row, col];
            try
            {
                for (int i = 0; i < row; i++)
                {
                    string[] singlerow = rows[i].Trim().Split(new char[] { ' ', ',' });
                    int      column    = 0;
                    for (int j = 0; column < col; j++)
                    {
                        if (j < singlerow.Length)
                        {
                            if (string.IsNullOrEmpty(singlerow[j]))
                            {
                                continue;
                            }
                            string str = new ExpData(singlerow[j].Trim()).GetValueEx();
                            data[i, column] = double.Parse(str);
                        }
                        else
                        {
                            data[i, column] = 0;
                        }
                        column++;
                    }
                }
            }
            catch (ExpError e)
            {
                throw new AssignedError(e.Message + "\nAssignmentError::矩阵转换出错\n");
            }
            Matrix matrix = new Matrix(data);

            cd = matrix;
            return(matrix);
        }
Exemplo n.º 10
0
 public int NeedExp(int lv)
 {
     if (lv < _maxLv)
     {
         return(ExpData.NeedExp(lv));
     }
     else
     {
         return(0);
     }
 }
Exemplo n.º 11
0
 void Start()
 {
     modularNo      = -5;
     infoEnumerator = StartIntro();
     StartCoroutine(infoEnumerator);
     dataRecord = GetComponent <ExpData>();
     if (ArCamera != null)
     {
         ArCamera.SetActive(false);
     }
 }
Exemplo n.º 12
0
        private CalData CalculatorArithmetic()
        {        //bugaid,只是最终完成简单的四则运算,添加双目运算符支持很简单的,基本上不用改什么
            //带参函数部分在PutFuncIntoData里面完成
            CalData sum = null;

            for (int i = 0; data[i] != null; i++)
            {
                if (data[i].GetTypeN() == 1)
                {
                    stacknum.Push(data[i].GetCalData());
                }
                else
                {
                    if (data[i].GetOption().op == '!')
                    {
                        CalData num1      = stacknum.Pop();
                        int     sumNumber = calculator.Factorial((int )(double.Parse(((ExpData)num1).GetValueEx())));
                        sum = new ExpData(sumNumber.ToString());
                    }
                    else
                    {
                        char    op   = data[i].GetOption().op;
                        CalData num1 = stacknum.Pop();
                        CalData num2 = stacknum.Pop();
                        if (num2 is ExpData && num1 is Matrix)
                        {
                            CalData temp = num2;
                            num2 = num1;
                            num1 = temp;
                            if (op == '-')
                            {
                                op   = '+';
                                num2 = (num2 as Matrix) * (-1);
                            }
                        }
                        sum = Calculator.CalSingleOperatorGeneric(num2, num1, op);
                    }
                    stacknum.Push(sum);
                }
            }
            CalData result = stacknum.Pop();

            if (stacknum.IsNotEmpty())
            {
                Wrong = true;
                stacknum.message.ErrorMessage += "Express Wrong!";
            }
            if (this.calculator.Wrong)
            {
                this.Wrong = true;
            }
            return(result);
        }
Exemplo n.º 13
0
    public bool TryGetInGameExpData(int level, out ExpData data)
    {
        data = null;

        if (InGameExpDatas.TryGetValue(level, out var inGameExpData))
        {
            data = new ExpData(inGameExpData);
            return(true);
        }

        Debug.LogError($"Error TryGetInGameExpData level:{level}");
        return(false);
    }
Exemplo n.º 14
0
 public ObjectValue[] GetExpressionValuesAsync(EvaluationContext ctx, string[] expressions)
 {
     ObjectValue[] values = new ObjectValue[expressions.Length];
     for (int n = 0; n < values.Length; n++)
     {
         string exp = expressions[n];
         // This is a workaround to a bug in mono 2.0. That mono version fails to compile
         // an anonymous method here
         ExpData edata = new ExpData(ctx, exp, this);
         values[n] = asyncEvaluationTracker.Run(exp, ObjectValueFlags.Literal, edata.Run);
     }
     return(values);
 }
Exemplo n.º 15
0
        public void InitNewModel()
        {
            if (ExpData == null)
            {
                throw new Exception("Projects is not initialized in the model.");
            }

            string par = "";

            //first time setting parameter
            if (ExpData.GetOutputColumnType() == ColumnType.Binary)
            {
                par = initBinaryClassParameters();
            }
            else if (ExpData.GetOutputColumnType() == ColumnType.Category)
            {
                par = initMultiClassParameters();
            }
            else
            {
                par = initRegressionParameters();
            }
            //
            var p = Parameters.FromString(par);
            //
            var fs = new Function[4] {
                new Function()
                {
                    Selected = true, Id = 2000, Weight = 1
                },
                new Function()
                {
                    Selected = true, Id = 2001, Weight = 1
                },
                new Function()
                {
                    Selected = true, Id = 2002, Weight = 1
                },
                new Function()
                {
                    Selected = true, Id = 2003, Weight = 1
                },
            };
            var t = terminalSet(p).ToArray();

            //
            Factory             = new Factory();
            Factory.FunctionSet = fs;
            Factory.TerminalSet = t;
            Factory.Parameters  = p;
        }
Exemplo n.º 16
0
        protected override HashSet <Subject> GetSubjectForTerm(Dictionary <string, object> termDict)
        {
            string expTypes = termDict["ExposureTypes"].ToString();
            string COLTypes = termDict["CausesOfLoss"].ToString();

            ExposureTypeCollection termExp;
            COLCollection          termCOL;

            if (COLTypes == "")
            {
                termCOL = contractSubject.CauseOfLossSet;
            }
            else
            {
                termCOL = new COLCollection(COLTypes);
            }

            if (expTypes == "")
            {
                termExp = contractSubject.ExposureTypes;
            }
            else
            {
                termExp = ExposureTypeCollection.BuildFromString(expTypes);
            }

            string          termSchedule = termDict["Schedule"].ToString();
            ScheduleOfRITEs schedule     = ExpData.GetSchedule(termSchedule);

            bool isPerRisk = false;

            if (termDict.ContainsKey("PerRisk") & termDict["PerRisk"].ToString() == "True")
            {
                isPerRisk = true;
            }

            PrimarySubject sub = new PrimarySubject(schedule, termExp, termCOL, isPerRisk);

            //DO NOT Explode
            //if (termDict.ContainsKey("PerRisk")
            //    & termDict["PerRisk"].ToString() == "True")
            //    return new HashSet<Subject>(ExplodeSubjectForPerRisk(sub).Cast<Subject>());
            //else
            //    return new HashSet<Subject>(){sub};

            return(new HashSet <Subject>()
            {
                sub
            });
        }
Exemplo n.º 17
0
        public BlockData ConverToBlock()
        {
            FuncString funstring    = new FuncString(strExpress);
            int        leftBracket  = funstring.FindOp(0, '(');
            int        rightBracket = funstring.FindOp(0, ')');
            int        commaSymbol  = funstring.FindOp(0, ',');

            string[] ab = strExpress.Split(',');
            double   a  = 0;
            double   b  = 0;

            try
            {
                string strA = new ExpData(ab[0].Substring(1)).GetValueEx();
                string strB = new ExpData(ab[1].Substring(0, ab[1].Length - 1)).GetValueEx();
                a = double.Parse(strA);
                b = double.Parse(strB);
            }
            catch (ExpError e)
            {
                throw new AssignedError(e.Message + "\nAssignmentError::区间转换出错" + "\n");
            }
            BlockData bd = new BlockData(a, b);
            bool      left;
            bool      right;

            if (leftBracket != -1 && leftBracket < commaSymbol)
            {
                left = false;
            }
            else
            {
                left = true;
            }
            if (rightBracket != -1 && rightBracket > commaSymbol)
            {
                right = false;
            }
            else
            {
                right = true;
            }
            bd.SetBlockBounderAvailable(left, right);
            cd = bd;
            return(bd);
        }
Exemplo n.º 18
0
        public void InitPersistedModel()
        {
            //gp panel
            if (Factory != null && Factory.Parameters != null)
            {
                var p = Factory.Parameters;

                //Input data
                //Inputs = ExpData.GetInputData(p.Constants);
                var rv      = ExpData.GetInputData();
                var dataSet = new ExperimentData(rv.train, rv.test, p.Constants);
                dataSet.SetExperiment(ExpData);
                Inputs = dataSet;

                //Calculate nonPersisted parameter properties
                Factory.Parameters.FeatureCount     = ExpData.GetEncodedColumnInputCount();
                Factory.Parameters.IsMultipleOutput = ExpData.GetEncodedColumnOutputCount() > 1;
            }
        }
Exemplo n.º 19
0
        public Dictionary <string, List <object> > ModelEvaluation()
        {
            var bs  = Factory.ProgresReport.BestSolution;
            var par = Factory.Parameters;
            var dic = new Dictionary <string, List <object> >();

            //
            if (bs != null)
            {
                //get output for training data set
                var yy     = ExpData.GetColumnOutputValues(false);
                var y1     = yy[0];//Inputs.GetDataOutputCol(true);//experiment
                var output = calculateOutput(true, true);

                //get output for testing data set if available
                var yy1     = ExpData.GetColumnOutputValues(true);
                var y2      = yy1 != null ? yy1[0] : null;//Inputs.GetDataOutputCol(false);//experiment
                var outputt = calculateOutput(false, true);

                //
                var col = ExpData.GetColumnsFromOutput().FirstOrDefault();
                if (col.ColumnDataType == ColumnType.Binary || col.ColumnDataType == ColumnType.Category)
                {
                    dic.Add("Classes", col.Statistics.Categories.ToList <object>());
                }


                //add data sets
                dic.Add("obs_train", y1.Select(x => (object)x).ToList <object>());
                dic.Add("prd_train", output.Select(x => (object)x).ToList <object>());
                //add test dataset
                if (y2 != null)
                {
                    dic.Add("obs_test", y2.Select(x => (object)x).ToList <object>());
                    dic.Add("prd_test", outputt.Select(x => (object)x).ToList <object>());
                }

                return(dic);
            }

            return(null);
        }
Exemplo n.º 20
0
        private List <int> terminalSet(Parameters p)
        {
            var colCount = ExpData.GetColumnInputCount() + p.ConstNum;

            if (colCount > 1000)
            {
                throw new Exception("GPdotNET supports up to 1000 features.");
            }

            p.FeatureCount     = ExpData.GetEncodedColumnInputCount();
            p.IsMultipleOutput = ExpData.GetEncodedColumnOutputCount() > 1;

            var term = new List <int>();

            for (int i = 0; i < colCount; i++)
            {
                term.Add(1000 + i);
            }

            return(term);
        }
Exemplo n.º 21
0
        protected Player(Player value) : base(value)
        {
            Exp                 = (ExpData)value.Exp.Clone();
            Inventory           = value.Inventory;
            worldInformation    = value.worldInformation;
            weapon              = value.weapon;
            armor               = value.armor;
            belt                = value.belt;
            necklace            = value.necklace;
            ring                = value.ring;
            monsterMap          = value.monsterMap;
            eventMap            = value.eventMap;
            hairIndex           = value.hairIndex;
            lensIndex           = value.lensIndex;
            earIndex            = value.earIndex;
            tailIndex           = value.tailIndex;
            characterLevelSheet = value.characterLevelSheet;

            _costumes   = value._costumes;
            _equipments = value._equipments;
        }
Exemplo n.º 22
0
        /// <summary>
        /// 一次性计算出结果 返回结果值并修改表达式
        /// </summary>
        /// <returns></returns>
        public string GetValueFinal()
        {
            CalData cd = UIController.SimpleCal(value);

            if (cd == null)
            {
                throw new AssignedError("AssignedError::Not defined " + express + "!Ex");
            }
            ExpData ed  = cd as ExpData;
            string  str = ed.GetValueEx();

//			string s =new UExpData ((cd as ExpData).GetExpress()).GetValueEx();
            if (str == null)
            {
                str = "0";
                throw new ExpError("ExpError::Something Wrong Happened!Final" + '\n');
            }
            value   = str;
            express = str;
            return(str);
        }
Exemplo n.º 23
0
        private HashSet <PrimarySubject> ExplodeSubjectForPerRisk(PrimarySubject primarySub)
        {
            //Per Risk, expand the schedule to all location subschedules
            if (primarySub.Schedule.IsLocation)
            {
                return new HashSet <PrimarySubject>()
                       {
                           primarySub
                       }
            }
            ;

            HashSet <PrimarySubject> ExplodedSubjects = new HashSet <PrimarySubject>();

            foreach (RITE Rite in primarySub.Schedule.ScheduleList)
            {
                //Check if schedule already exists in exposure data with RITE
                ScheduleOfRITEs schedule;

                if (FindScheduleWithRite(Rite, out schedule))
                {
                    ExplodedSubjects.Add(new PrimarySubject(schedule, primarySub.ExposureTypes, primarySub.CauseOfLossSet));
                }
                else
                {
                    //Create new schedule in exposure data
                    string newScheduleName = primarySub.Schedule.Name + " ." + Rite.ExposureID;
                    ExpData.AddSchedule(newScheduleName, new HashSet <RITE>()
                    {
                        Rite
                    });
                    ExplodedSubjects.Add(new PrimarySubject(ExpData.GetSchedule(newScheduleName), primarySub.ExposureTypes, primarySub.CauseOfLossSet));
                }
            }

            return(ExplodedSubjects);
        }
Exemplo n.º 24
0
        public bool setLearningType(Parameters param)
        {
            //determine the type of ML
            param.OutputType = ExpData.GetOutputColumnType();
            if (param.OutputType == ColumnType.Binary)
            {
                if (param.RootName.StartsWith("Sigm"))
                {
                    param.RootFunctionNode = new Function()
                    {
                        Id = 2048, Name = "Sigmoid", Arity = 1, HasParameter = true, Parameter = param.Threshold, Parameter2 = 2
                    }
                }
                ;
                else if (param.RootName.StartsWith("Step"))
                {
                    param.RootFunctionNode = new Function()
                    {
                        Id = 2049, Name = "Step", Arity = 1, HasParameter = true, Parameter = param.Threshold, Parameter2 = 2
                    }
                }
                ;
                else if (param.RootName.StartsWith("Scal"))
                {
                    param.RootFunctionNode = new Function()
                    {
                        Id = 2050, Name = "SSigmoid", Arity = 1, HasParameter = true, Parameter = param.Threshold, Parameter2 = 2
                    }
                }
                ;
                else if (param.RootName.StartsWith("Soft"))
                {
                    param.RootFunctionNode = new Function()
                    {
                        Id = 2051, Name = "Softmax", Arity = 2, Parameter2 = 2
                    }
                }
                ;
            }
            else if (param.OutputType == ColumnType.Category)
            {
                var clss = ExpData.GetColumnsFromOutput().FirstOrDefault().Statistics.Categories.Count;

                if (param.RootName.StartsWith("Scal"))
                {
                    param.RootFunctionNode = new Function()
                    {
                        Id = 2050, Name = "SSigmoid", Arity = 1, HasParameter = true, Parameter = clss, Parameter2 = clss
                    }
                }
                ;
                else if (param.RootName.StartsWith("Soft"))
                {
                    param.RootFunctionNode = new Function()
                    {
                        Id = 2051, Name = "Softmax", Arity = clss, Parameter2 = clss
                    }
                }
                ;
                else
                {
                    throw new Exception("Predefined Root Node is not compatible with multi class classification modeling!");
                }
            }
            else if (param.OutputType == ColumnType.Numeric)
            {
                if (param.RootName.StartsWith("Pol3"))
                {
                    param.RootFunctionNode = Globals.GetFunction(2039);// new Function() { Id = 2050, Name = "P3", Arity = 1, HasParameter = true, Parameter = clss, Parameter2 = clss };
                }
            }
            return(true);
        }
Exemplo n.º 25
0
 protected ExpData(ExpData value)
 {
     Max     = value.Max;
     Need    = value.Need;
     Current = value.Current;
 }
Exemplo n.º 26
0
    void SetBabyInfo(Baby inst)
    {
        skillDatas.Clear();
        if (inst == null)
        {
            return;
        }
        nameLabel.text    = inst.InstName;
        loyaltyLabel.text = inst.GetIprop(PropertyType.PT_Glamour).ToString();
        levelLabel.text   = inst.GetIprop(PropertyType.PT_Level).ToString();

        diSlider.value      = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Ground / 10f;
        fengSlider.value    = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Wind / 10f;
        shuiSlider.value    = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Water / 10f;
        huoSlider.value     = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Fire / 10f;
        leixngSp.spriteName = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Tpye.ToString();
        zhandouliLabel.text = inst.GetIprop(PropertyType.PT_FightingForce).ToString();
        for (int i = 0; i < skillIcons.Length; ++i)
        { //初始化
            Listener         = UIEventListener.Get(skillIcons[i].GetComponent <UIButton>().gameObject);
            Listener.onPress = null;
            UIManager.RemoveButtonEventHandler(skillIcons[i].gameObject, EnumButtonEvent.OnClick);
            Transform ssp = skillIcons[i].transform.FindChild("suo000");
            ssp.gameObject.SetActive(false);
            ssp = skillIcons[i].transform.FindChild("skillicon");
            ssp.gameObject.SetActive(false);
        }
        BabyData bdata = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId));

        for (int i = 0; i < inst.SkillInsts.Count; i++)
        {
            SkillData sdata = SkillData.GetMinxiLevelData((int)inst.SkillInsts[i].skillID_);
            if (sdata._Name.Equals(LanguageManager.instance.GetValue("playerPro_FightBack")))
            {
                continue;
            }
            if (sdata._Name.Equals(LanguageManager.instance.GetValue("playerPro_Dodge")))
            {
                continue;
            }
            skillDatas.Add(sdata);
        }

        for (int i = 0; i < skillDatas.Count; ++i)
        {
            if (i > skillIcons.Length)
            {
                break; /// rongcuo
            }
            if (i > bdata._SkillNum)
            {
                break; ///错误
            }
            skillIcons[i].gameObject.SetActive(true);
            Transform ssp = skillIcons[i].transform.FindChild("suo000");
            ssp.gameObject.SetActive(false);
            ssp = skillIcons[i].transform.FindChild("skillicon");
            ssp.gameObject.SetActive(true);
            UITexture sp = skillIcons[i].GetComponentInChildren <UITexture>();
            iconNames_.Add(skillDatas[i]._ResIconName);
            HeadIconLoader.Instance.LoadIcon(skillDatas[i]._ResIconName, sp);
            Listener           = UIEventListener.Get(skillIcons[i].GetComponent <UIButton>().gameObject);
            Listener.parameter = skillDatas[i]._Id;
            Listener.onPress   = buttonPress;
        }
        for (int i = 0; i < skillIcons.Length; i++)
        {
            if (i < skillDatas.Count)
            {
                Transform ps = skillIcons [i].transform.FindChild("Ps");
                ps.gameObject.SetActive(false);
            }
            if (i < bdata._SkillNum && i >= skillDatas.Count)
            {
                Transform ps = skillIcons [i].transform.FindChild("Ps");
                ps.gameObject.SetActive(true);
                skillIcons [i].gameObject.SetActive(true);
                UIManager.SetButtonEventHandler(skillIcons [i].gameObject, EnumButtonEvent.OnClick, OnClickSkillNpc, 0, 0);
            }
            if (i >= bdata._SkillNum)
            {
                skillIcons [i].gameObject.SetActive(false);
            }
        }
        int Protect = 0;

        oldLevel = 0;
        GlobalValue.Get(Constant.C_AucGoodProtect, out Protect);
        //FormatTimeHasDay ((int)inst.GetInst ().lastSellTime_);
        //int day = (Protect - GlobalInstanceFunction.Instance.DayPass ((int)inst.GetInst ().lastSellTime_));
        dongjieSp.text = FormatTimeHasDay((int)inst.GetInst().lastSellTime_);          //LanguageManager.instance.GetValue ("dongjie").Replace ("{n}",day.ToString());
        if (inst.GetInst().lastSellTime_ <= 0)
        {
            dongjieObj.SetActive(false);
        }
        else
        {
            dongjieObj.SetActive(true);
        }

        curExp = (long)inst.Properties[(int)PropertyType.PT_Exp];
        maxExp = ExpData.GetBabyMaxExp(inst.GetIprop(PropertyType.PT_Level));
        if (inst.GetIprop(PropertyType.PT_Level) > 1)
        {
            oldLevel = (inst.GetIprop(PropertyType.PT_Level) - 1);
        }
        else
        {
            oldExp = 0;
        }
        oldExp = ExpData.GetBabyMaxExp(oldLevel);
        long s = curExp - oldExp;

        if (s < 0)
        {
            s = 0;
        }
        Expl.value       = (s * 1f) / ((maxExp - oldExp) * 1f);
        exptextLbel.text = s + "/" + (maxExp - oldExp);


//		if(inst.GetIprop(PropertyType.PT_Level)>1)
//		{
//			oldLevel = (inst.GetIprop(PropertyType.PT_Level)-1);
//		}else
//		{
//			oldexp = 0;
//		}
//		oldexp = ExpData.GetBabyMaxExp(oldLevel);
//
//        int fExp = 0;
//        int bExp = 0;
//		if(inst.GetIprop(PropertyType.PT_Level)>1)
//		{
//            fExp = (curExp-oldexp);
//            bExp = (maxExp-oldexp);
//			exptextLbel.text = fExp + "/" + bExp;
//		}
//        else
//		{
//            fExp = curExp;
//            bExp = maxExp;
//			exptextLbel.text = curExp + "/" + maxExp;
//		}
//        Expl.value = (float)fExp / (float)bExp;
//		Expl.value = (curExp * 1f) / (maxExp * 1f);
        //Debug.Log ("curexp ==" + curExp + "   maxExp==" + maxExp + "  oldExp==" + oldexp + "  (maxExp-oldExp)" + (maxExp - oldexp));
    }
Exemplo n.º 27
0
        public double[] calculateOutput(bool isTraining, bool probValue = false)
        {
            if (Factory.ProgresReport.BestSolution == null)
            {
                return(null);
            }
            //
            var ch  = Factory.ProgresReport.BestSolution;//.expressionTree;
            var par = Factory.Parameters;

            if (par.RootFunctionNode == null)
            {
                setLearningType(par);
            }
            double[] yc = null;
            if (ch != null)
            {
                yc = Inputs.CalculateOutput(ch, par, isTraining);//gp

                //no testing data set
                if (yc == null)
                {
                    return(null);
                }

                //de normalize output
                double[] output = yc;
                for (int i = 0; i < yc.Length; i++)
                {
                    //calculate de normalization
                    if (ExpData.GetOutputColumnType() == ColumnType.Numeric)
                    {
                        double[] normRow = new double[1] {
                            yc[i]
                        };
                        output[i] = ExpData.GetDecodedOutputRow(normRow)[0];
                    }
                    else
                    {
                        if (par.RootFunctionNode.Id == 2048) //sigmoid
                        {
                            if (probValue)                   //when model is evaluate we need probability f event in order to optimize threshold value
                            {
                                output[i] = yc[i];
                            }
                            else
                            {
                                output[i] = yc[i] > par.RootFunctionNode.Parameter ? 1 : 0;
                            }
                        }
                        else if (par.RootFunctionNode.Id == 2050)//step
                        {
                            output[i] = Math.Truncate(yc[i]);
                        }
                        else
                        {
                            output[i] = Math.Truncate(yc[i]);
                        }
                    }
                }
                return(output);
            }
            return(null);//no solution yet
        }
Exemplo n.º 28
0
 public ExpData(ExpData inGameExpData)
 {
     Level         = inGameExpData.Level;
     SatisfyExp    = inGameExpData.SatisfyExp;
     CumulativeExp = inGameExpData.CumulativeExp;
 }
Exemplo n.º 29
0
    void Start()
    {
        sItem.SetActive(false);
        dItem.SetActive(false);
        if (GamePlayer.Instance.BattleBaby != null)
        {
            if (!GamePlayer.Instance.BattleBaby.isDead)
            {
                babykuang.SetActive(true);
                //babyExpLabel.text = "+"+ Battle.Instance.BattleBabyExp.ToString();
                HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData((int)GamePlayer.Instance.BattleBaby.Properties[(int)PropertyType.PT_AssetId]).assetsIocn_, babyIcon);
                HeadIconLoader.Instance.LoadIcon(BabyData.GetData((int)GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_TableId))._RaceIcon, RaceIcon);
                BabyExp.value     = (float)GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_Exp) / ExpData.GetBabyMaxExp(GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_Level));
                babyExpLabel.text = Battle.Instance.BattleBabyExp.ToString();
                //StartCoroutine(NumScrollEffect((int)Battle.Instance.BattleBabyExp,babyExpLabel));
            }
        }
        else
        {
            babykuang.SetActive(false);
        }

        playerExpLabel.text = Battle.Instance.BattleReward.playExp_.ToString();
        //StartCoroutine(NumScrollEffect((int)Battle.Instance.BattleReward.playExp_,playerExpLabel));
        MoneyLabel.text = Battle.Instance.BattleReward.money_.ToString();
        //StartCoroutine(NumScrollEffect((int)Battle.Instance.BattleReward.money_,MoneyLabel));

        HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData((int)GamePlayer.Instance.Properties[(int)PropertyType.PT_AssetId]).assetsIocn_, playerIcon);

        long curExp   = (long)GamePlayer.Instance.Properties [(int)PropertyType.PT_Exp];
        long macExp   = ExpData.GetPlayerMaxExp(GamePlayer.Instance.GetIprop(PropertyType.PT_Level));
        long valueExp = curExp / macExp;

        playerExp.value = (float)valueExp;


//		levelup.gameObject.SetActive(false);
//		clevelup.gameObject.SetActive (false);
        hasDestroyed = false;
        //babyL.gameObject.SetActive (false);
        //playerL.gameObject.SetActive (false);
        GlobalInstanceFunction.Instance.Invoke(() => { OnClickclose(null, null, 0, 0); }, 5f);
        //skillItem.SetActive (false);
        //iItem.SetActive (false);
        bool isFlag = true;

        // Battle.Instance.BattleReward.skills_;

        for (int i = 0; i < Battle.Instance.BattleReward.skills_.Length; i++)
        {
            if (i < 5)
            {
                cskills.Add(Battle.Instance.BattleReward.skills_[i]);
            }
        }

        List <COM_Skill> tmpsk = new List <COM_Skill>();

        for (int i = 0; i < cskills.Count; ++i)
        {
            if (tmpsk.Count == 0)
            {
                tmpsk.Add(cskills[i]);
            }
            else
            {
                for (int j = 0; j < tmpsk.Count; ++j)
                {
                    if (tmpsk[j].skillID_ == cskills[i].skillID_)
                    {
                        tmpsk[j].skillExp_  += cskills[i].skillExp_;
                        tmpsk[j].skillLevel_ = cskills[i].skillLevel_;
                        isFlag = false;
                    }
                }
                if (isFlag)
                {
                    tmpsk.Add(cskills[i]);
                    isFlag = true;
                }
            }
        }

        AddSkillItems(tmpsk);
        item = Battle.Instance.BattleReward.items_;
        AddPropsItems(item);
//			for(int i = 0 ;i <item.Length;i++)
//			{
//				ItemData idata = ItemData.GetData((int)item[i]);
//				itemDa.Add(idata);
//			}
//		    PlayerName = GamePlayer.Instance.InstName;
//			PlayerExp = Battle.Instance.BattleReward.playExp_.ToString ();
//			playerL.text = PlayerName;
//			playerE.text = PlayerExp;
//		   moneyLabel.text = Battle.Instance.BattleReward.money_.ToString ();
        //HeadIconLoader.Instance.LoadIcon (EntityAssetsData.GetData((int)GamePlayer.Instance.Properties[(int)PropertyType.PT_AssetId]).assetsIocn_, icon);


//		    if (GamePlayer.Instance.BattleBaby != null)
//			{
//				if(!GamePlayer.Instance.BattleBaby.isDead)
//				{
//				    chongObj.gameObject.SetActive(true);
//					if(GamePlayer.Instance.BattleBaby.isLevelUp_)
//					{
//					clevelup.gameObject.SetActive(true);
//					    //PopText.Instance.Show (levelup.mainTexture);
//						EffectAPI.PlayUIEffect((EFFECT_ID)GlobalValue.EFFECT_PlayerLvUpOnUI, transform);
//					}
//					babyL.gameObject.SetActive(true);
//					babyE.gameObject.SetActive(true);
//					fuhaoSp.gameObject.SetActive(true);
//					//textSp.gameObject.SetActive(true);
//					babyName = GamePlayer.Instance.BattleBaby.InstName;
//					babyExp = Battle.Instance.BattleBabyExp.ToString();
//                    Battle.Instance.BattleBabyExp = 0;
//					babyL.text = babyName;
//					babyE.text = babyExp;
//				HeadIconLoader.Instance.LoadIcon (EntityAssetsData.GetData((int)GamePlayer.Instance.BattleBaby.Properties[(int)PropertyType.PT_AssetId]).assetsIocn_, cicon);
//				HeadIconLoader.Instance.LoadIcon (BabyData.GetData((int)GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_TableId)).RaceIcon_, raceIcon);
//			   }
//
//			}
//			else
//			{
//				babyL.gameObject.SetActive(false);
//				babyE.gameObject.SetActive(false);
//				fuhaoSp.gameObject.SetActive(false);
//			    chongObj.gameObject.SetActive(false);
//
//			}



        GamePlayer.Instance.OpenSystemEnvetString += new RequestEventHandler <int> (UpdateOpenSystemStr);

        //GameManager.Instance.GetActorClone((ENTITY_ID)GamePlayer.Instance.Properties[(int)PropertyType.PT_AssetId], (ENTITY_ID)GamePlayer.Instance.WeaponAssetID, AssetLoadCallBack, new ParamData(GamePlayer.Instance.InstId), "UI");

        UIManager.SetButtonEventHandler(closeBtn.gameObject, EnumButtonEvent.OnClick, OnClickclose, 0, 0);

        GuideManager.Instance.RegistGuideAim(closeBtn.gameObject, GuideAimType.GAT_BattleRewardClose);

        GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_BattleOverRewardOpen);
    }
Exemplo n.º 30
0
		public ObjectValue[] GetExpressionValuesAsync (EvaluationContext ctx, string[] expressions)
		{
			ObjectValue[] values = new ObjectValue[expressions.Length];
			for (int n = 0; n < values.Length; n++) {
				string exp = expressions[n];
				// This is a workaround to a bug in mono 2.0. That mono version fails to compile
				// an anonymous method here
				ExpData edata = new ExpData (ctx, exp, this);
				values[n] = asyncEvaluationTracker.Run (exp, ObjectValueFlags.Literal, edata.Run);
			}
			return values;
		}
Exemplo n.º 31
0
        /// <summary>
        /// Run GP Program
        /// </summary>
        public async Task RunGPAsync(ActiveDataBase currentData, CancellationToken cancellationToken, bool resetPrevSolution)
        {
            try
            {
                if (resetPrevSolution)
                {
                    ResetModel();
                }
                //Get parameters from Settings panel
                var param = Parameters.FromDictionary(currentData.Parameters.ToDictionary());

                //set random constants
                setRandomConstants(param, resetPrevSolution);


                //use this only when developing this module in order to make debug simple
                //param.ParallelProcessing = false;

                //create fitness function

                //Inputs = ExpData.GetInputData(param.Constants);
                var rv      = ExpData.GetInputData();
                var dataSet = new ExperimentData(rv.train, rv.test, param.Constants);
                dataSet.SetExperiment(ExpData);
                Inputs = dataSet;
                //
                param.FitnessFunction = selectFitnessFunction(param.FitnessName, Inputs);

                if (param.FitnessFunction == null)
                {
                    throw new Exception("Fitness type is not defined!");
                }

                //define Learning type
                setLearningType(param);

                //creating function and terminal set
                Function[] functionSet = copyFunctionSet(currentData.FunctionSet);


                var term = terminalSet(param);
                //create termination criteria
                var terrCriteria = new TerminationCriteria()
                {
                    IsIteration = currentData.TC.IsIteration, Value = currentData.TC.Value
                };
                //create GPFactory
                if (Factory != null && !resetPrevSolution)
                {
                    Factory.Population.Token = cancellationToken;
                    Factory.Continue(param, functionSet, term.ToArray());
                }
                else
                {
                    Factory = new Core.Factory(param, functionSet, term.ToArray(), cancellationToken);
                }

                IsDiry = true;

                //start GP
                await Factory.RunAsync(currentData.reportRun, terrCriteria, cancellationToken);
            }
            catch (Exception)
            {
                throw;
            }
        }