Пример #1
0
    public void initDifficultyButtons()
    {
        List <LevelMod> level_mod = LevelStore.getLevelSettings(Central.Instance.current_lvl);

        Difficulty max_diff       = level_mod[level_mod.Count - 1].difficulty;
        bool       insane_allowed = ScoreKeeper.Instance.checkIfAlreadyHaveScore(Central.Instance.current_lvl, Difficulty.Hard);

        //  Debug.Log($"Max is {max_diff} insane allowed? {insane_allowed}\n");
        if (max_diff == Difficulty.Insane)
        {
            setDifficultyButton(2, true, insane_allowed, false);
            setDifficultyButton(1, true, true, false);
        }
        else if (max_diff == Difficulty.Hard)
        {
            setDifficultyButton(2, false, false, false);
            setDifficultyButton(1, true, true, false);
        }
        else
        {
            setDifficultyButton(2, false, false, false);
            setDifficultyButton(1, false, false, false);
        }
        setDifficultyButton(0, true, true, true);
    }
Пример #2
0
    private void baseload()
    {
        #region 初始化级别
        var lavel = from c in dc.CsBaseinfoset
                    where c.Fid == int.Parse(PublicMethod.ReadXmlReturnNode("SWJB", this))
                    select new
        {
            YHLevelID = c.Infoid,
            YHLevel   = c.Infoname
        };
        LevelStore.DataSource = lavel;
        LevelStore.DataBind();
        #endregion

        #region 初始化类型
        var type = from t in dc.CsBaseinfoset
                   where t.Fid == int.Parse(PublicMethod.ReadXmlReturnNode("ZY", this))
                   orderby t.Infoid ascending
                   select new
        {
            YHTypeID = t.Infoid,
            YHType   = t.Infoname
        };
        TypeStore.DataSource = type;
        TypeStore.DataBind();
        #endregion
    }
Пример #3
0
    private void SearchLoad()//查询窗口初始化 已改
    {
        //DBSCMDataContext dc = new DBSCMDataContext();
        //初始化日期
        //df_begin.SelectedDate = System.DateTime.Today.AddDays(-6);
        //df_end.SelectedDate = System.DateTime.Today;
        //初始化部门
        var dept = from d in dc.Department
                   where d.Deptnumber.Substring(0, 4) == SessionBox.GetUserSession().DeptNumber.Substring(0, 4) &&
                   d.Deptnumber.Substring(7) == "00"
                   orderby d.Deptname
                   select new
        {
            d.Deptnumber,
            d.Deptname
        };

        DeptStore.DataSource = dept;
        DeptStore.DataBind();
        //初始化级别
        var lavel = from c in dc.CsBaseinfoset
                    where c.Fid == int.Parse(PublicMethod.ReadXmlReturnNode("SWJB", this))
                    select new
        {
            SWLevelID = c.Infoid,
            SWLevel   = c.Infoname
        };

        LevelStore.DataSource = lavel;
        LevelStore.DataBind();
    }
Пример #4
0
    public void loadSnapshot(RuneSaver saver)
    {
        runetype       = saver.runetype;
        toy_type       = saver.toy_type;
        invested_cost  = saver.invested_cost;
        ID             = saver.ID;
        level          = saver.level;
        xp             = saver.xp;
        distance_bonus = saver.distance_bonus;
        order          = saver.order;

        if (saver.max_level < 0)
        {
            saver.max_level = 0;
        }
        int max_level = Mathf.Max(saver.max_level,
                                  LevelStore.getMaxLevel(Central.Instance.current_lvl, Peripheral.Instance.difficulty, runetype, toy_type));

        setMaxLevel(max_level);

        Sun.OnDayTimeChange += OnDayTimeChange;
        StaticRune.assignStatBits(ref stats, this);

        foreach (StatBitSaver s in saver.stats)
        {
            StatBit stat = getStat(s.effect_type);
            stat.loadSnapshot(s, this);
        }

        UpdateTimeOfDay();
        setXpReqs();
        UpdateStats();
    }
Пример #5
0
        private IEnumerable <KeyValuePair <IBlock, Vec> > Parse(LevelStore levelStore)
        {
            var iBlockType = typeof(IBlock);
            var asm        = iBlockType.Assembly;

            foreach (var obj in levelStore.Objects)
            {
                var type = asm.GetType($"{iBlockType.Namespace}.{obj.Name}");
                yield return(new KeyValuePair <IBlock, Vec>((IBlock)Activator.CreateInstance(type), obj.Pos));
            }
        }
Пример #6
0
    void Start()
    {
        //   Fabric.Runtime.Fabric.Initialize();
        Crashlytics.SetDebugMode(true);
        TowerStore.initTowers();
        EnemyStore.initEnemies();
        LevelStore.initSettings();

        //file = new Queue<string>(init_file.text.Split('\n'));
        //Loader.Instance.setFile (file);
        //Loader.Instance.LoadInitFile ();
    }
Пример #7
0
    public void saveHighScore()    //new for menu 2
    {
        LevelStore ls = new LevelStore();

        for (int x = 0; x < levels.Length; x++)
        {
            if (levels [x].levelName == curLevel)
            {
                ls = levels [x];
            }
        }

        ScoreController sc = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScoreController> ();

        Debug.Log("Saving high score " + sc.getScore() + " For level " + curLevel);
        ls.save(sc.getScore());
        checkForLevelUnlocked();
    }
Пример #8
0
    public void initDifficultySlider()
    {
        List <LevelMod> level_mod = LevelStore.getLevelSettings(Central.Instance.current_lvl);

        int max_diff = (int)level_mod[level_mod.Count - 1].difficulty;

        if (max_diff > 1)
        {
            difficulty_parent_object.SetActive(true);
            difficulty_slider.minValue = 1;
            difficulty_slider.maxValue = max_diff;
            difficulty_slider.value    = 1;
        }
        else
        {
            difficulty_slider.value = 1;
            difficulty_parent_object.SetActive(false);
        }
    }
Пример #9
0
    private void SearchLoad()//查询窗口初始化
    {
        //初始化日期
        df_begin.SelectedDate = System.DateTime.Today.AddDays(-15);
        df_end.SelectedDate   = System.DateTime.Today;
        #region 初始化部门
        DeptStore.DataSource = PublicCode.GetKQdept(SessionBox.GetUserSession().DeptNumber);
        DeptStore.DataBind();
        #endregion

        #region 初始化单位
        if (SessionBox.GetUserSession().rolelevel.Trim().IndexOf("1") > -1)
        {
            UnitStore.DataSource = PublicCode.GetMaindept("");
            UnitStore.DataBind();
            cbbUnit.Disabled = false;

            cbb_part.Disabled = true;
        }
        else
        {
            UnitStore.DataSource = PublicCode.GetMaindept(SessionBox.GetUserSession().DeptNumber);
            UnitStore.DataBind();
            cbbUnit.SelectedItem.Value = SessionBox.GetUserSession().DeptNumber;
            cbbUnit.Disabled           = true;
        }
        #endregion
        //三违级别
        var lavel = from c in dc.CsBaseinfoset
                    where c.Fid == int.Parse(PublicMethod.ReadXmlReturnNode("SWJB", this))
                    select new
        {
            SWLevelID = c.Infoid,
            SWLevel   = c.Infoname
        };
        LevelStore.DataSource = lavel;
        LevelStore.DataBind();
    }
    IEnumerator switchScene()
    {
        yield return(new WaitForSeconds(4));

        LevelStore.loadNextLevel();
    }
Пример #11
0
    public void initStats(unitStats s, Vector3 scaleV, Island_Button i, string _name, Rune _rune)
    {
        tilesize = i.getPeripheral().tileSize;
        stats    = s;
        float dmg_base = 0;

        my_name                    = _name;
        my_tower_stats             = new tower_stats();
        my_tower_stats.island_name = string.Copy(i.ID);
        my_tower_stats.wave_time   = Moon.Instance.TIME;
        my_tower_stats.initSkillStats(runetype);
        if (building.tower_visual)
        {
            building.tower_visual.updateVisuals();
            building.tower_visual.setSprite(true);
        }

        Rune.onUpgrade += onUpgrade;

        float bonus = 0f;

        //  float bonus = StaticRune.GetDistanceBonus(my_name, this.transform.position, this);
        Debug.Log($"TOY Initializing {toy_type} {runetype}\n");
        if (_rune == null || toy_type != ToyType.Hero)
        {
            rune = new Rune();
            SetBonus(bonus);
            int max_lvl = LevelStore.getMaxLevel(Central.Instance.current_lvl, Peripheral.Instance.difficulty, runetype, toy_type);

            rune.initStats(runetype, max_lvl, toy_type);
            Debug.Log($"TOY Initializing {toy_type} {runetype} new rune lvl {max_lvl}\n");
        }
        else
        {
            SetBonus(bonus);
            rune = _rune;
            rune.UpdateStats();
            Debug.Log($"TOY Initializing {toy_type} {runetype} EXISTING rune lvl {rune.getMaxLevel()}\n");
        }
        Active  = true;
        island  = i;
        rune.ID = this.gameObject.GetInstanceID();
        center.localPosition = Vector3.Scale(center.localPosition, scaleV);
        //        my_toy.center.localPosition = Vector3.Scale(my_toy.center.localPosition, scaleV);
        transform.transform.localRotation = Quaternion.identity;

        building.initStats(this);
        //


        // if (rune.level > 0 && rune_buttons != null) rune_buttons.UpdateMe();

        if (parent_toy != null)
        {
            parent_toy.AddTargetToy(this);
        }


        if (toy_type == ToyType.Hero)
        {
            //rune.InitHero(Central.Instance.current_lvl);//for testing, gives hero some xp based on current level, if xp is 0
            // also sensible hero comes with airattack for free, done by an event in 02level_scene
            rune.setMaxLevel((int)Mathf.Max(Central.Instance.getToy(my_name).getMaxLvl(), rune.getMaxLevel()));
        }

        if (firearm != null)
        {
            firearm.initStats(this);
        }
        //if (rune_buttons != null) rune_buttons.UpdateMe(); // ghost towers don't get their own rune buttons
        TIME_AT_START = Time.time;
    }
Пример #12
0
 public LevelMod getLevelMod()
 {
     return(LevelStore.getLevelMod(Central.Instance.current_lvl, difficulty));
 }