Exemplo n.º 1
0
        public void EnvTest()
        {
            var a = new Symbol("a", NilV);
            var b = new Symbol("b", NilV);
            var c = new Symbol("c", NilV);
            var d = new Symbol("d", NilV);

            var env1 = new Env(
                MapM.Empty <Symbol, MalType>().Add(a, new Str("a")).Add(b, new Str("b")),
                null);

            var env2 = new Env(
                MapM.Empty <Symbol, MalType>().Add(c, new Str("c")),
                env1);


            env2.Set(d, new Str("d"));

            Assert.AreSame(env1, env2.Find(a));
            Assert.AreSame(env1, env2.Find(b));
            Assert.AreSame(env2, env2.Find(c));
            Assert.AreSame(env2, env2.Find(d));
            Assert.IsNull(env2.Find(new Symbol("e", NilV)));

            Assert.AreEqual(new Str("a"), env2.Get(a));
            Assert.AreEqual(new Str("b"), env2.Get(b));
            Assert.AreEqual(new Str("c"), env2.Get(c));
            Assert.AreEqual(new Str("d"), env2.Get(d));
            Assert.ThrowsException <Exception>(() => env2.Get(new Symbol("e", NilV)));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 资源卸载
 /// </summary>
 public override void Clear()
 {
     SoundPlay.PlayBackGroundSound("bgm_city_loop", true, false);
     MapM.ClearMap();
     CM.ExitCm();
     ShipBombRule.ClearBombData();
     WndManager.DestroyAllDialogs();
 }
Exemplo n.º 3
0
 //占领格子完成,在lateupdata 中调用
 public static void  FinishStations()
 {
     //完成格子占领分析
     MapM.ResolveStations();
     //对格子通道进行排序
     MapM.SortGridRank();
     MapM.ClearUpRoleStation();
 }
Exemplo n.º 4
0
 public static void ExitCm()
 {
     EventCenter.AntiAllRegisterHooks();
     MapM.ClearMapLife();
     m_SoldierList.Clear();
     m_PetList.Clear();
     m_BuildList.Clear();
     m_WallList.Clear();
     m_FoorList.Clear();
     m_SummonPetList.Clear();
 }
Exemplo n.º 5
0
    /// <summary>
    /// 加载战斗地图
    /// </summary>
    private static void LoadCombatMap()
    {
        ShipCanvasInfo Info = CmCarbon.GetDefenseMap();

        if (Info != null)
        {
            Info.GetMapData();
            BattleEnvironmentM.ResetStartPos(Info.GetMapSize(), true);
            MapM.CreateMap(Info);
            ShipBombRule.SetBombMap(Info);
        }
    }
Exemplo n.º 6
0
    public void GetNextDeep()
    {
        int deep = MapM.GetRankDeep(m_SceneID);

        if (deep != -1)
        {
            if (RankDeep != deep)
            {
                ChangeDeep(deep);
            }
            RankDeep = deep;
        }
    }
Exemplo n.º 7
0
 /// <summary>
 /// 构建战斗环境
 /// </summary>
 public static void BuildScene()
 {
     U3DUtil.DestroyAllChild(m_MapStart.gameObject);
     if (m_Mode == BattleEnvironmentMode.CombatPVE)
     {
         MapM.ClearMap();
         CM.ExitCm();
         BuildCombatPVEScene();
     }
     else if (m_Mode == BattleEnvironmentMode.Edit)
     {
         BuildCombatEditScene();
     }
 }
Exemplo n.º 8
0
    /// <summary>
    /// 角色预报占领攻击位动作
    /// </summary>
    /// <returns></returns>
    public void InputStations(int SceneID, StationsInfo Rs)
    {
        //检查是否为攻击位

        /*if(IsAttackStations () == false)
         *      return ;*/
        //检查是否已经包含该角色
        if (m_HoldRole.CheckHaveRole(SceneID) == true)
        {
            return;
        }

        //先清理,前任所在的攻击位
        MapM.EmptyRoleStations(SceneID, LifeMType.SOLDIER);
        m_TempRole.AddRole(SceneID, Rs);
        MapM.AddUpRoleStation(this);
        MapM.ChangeRoleStation(SceneID, this);
    }
Exemplo n.º 9
0
    public void SetBorn(Int2 BornPos, int deep)
    {
        MapPos           = BornPos;
        m_AttackStation  = MapPos;
        m_NAttackStation = MapPos;
        m_NGrid          = BornPos;
        RankDeep         = deep;
        //
        MapGrid m = MapGrid.GetMG(MapPos);

        if (m != null)
        {
            if (MapM.AskForMapGridDeep(m_SceneID, m, deep, RoleParent.m_Core.m_Camp, DIR.LEFT, SEARCHAGT.SAGTY_POLL, ref BornPos, ref deep))
            {
                m        = MapGrid.GetMG(BornPos);
                RankDeep = deep;
                MapCheckStations.RoleStation(m_SceneID, m, new StationsInfo(RoleParent.m_Attr as RoleAttribute,
                                                                            RankDeep,
                                                                            RoleParent.m_Core.m_Camp,
                                                                            DIR.LEFT,
                                                                            GridSpace.Space_DOWN));
            }
        }
    }
Exemplo n.º 10
0
        public void ApplyDefTest()
        {
            var env1 = EmptyEnv();

            Assert.ThrowsException <Exception>(() => EvalM.ApplyDef(MalLListFrom(), env1));
            Assert.ThrowsException <Exception>(() => EvalM.ApplyDef(MalLListFrom(new Symbol("a", NilV)), env1));
            Assert.ThrowsException <Exception>(() => EvalM.ApplyDef(MalLListFrom(
                                                                        new Symbol("a", NilV), new Number(1), new Number(1)), env1));

            var mal1 = EvalM.ApplyDef(MalLListFrom(new Symbol("x", NilV), new Number(1)), env1);

            Assert.AreEqual(new Number(1), mal1);
            Assert.AreEqual(new Number(1), env1.Get(new Symbol("x", NilV)));


            var env2 = new Env(MapM.Empty <Symbol, MalType>(), DefaultEnv());
            var mal2 = EvalM.ApplyDef(MalLListFrom(
                                          new Symbol("y", NilV),
                                          MalListFrom(new Symbol("+", NilV), new Number(1), new Number(2))
                                          ), env2);

            Assert.AreEqual(new Number(3), mal2);
            Assert.AreEqual(new Number(3), env2.Get(new Symbol("y", NilV)));
        }
Exemplo n.º 11
0
 // creates a new Env when necessary, remember Env is mutated
 public static Env EmptyEnv() => new Env(MapM.Empty <Symbol, MalType>(), null);
Exemplo n.º 12
0
 public static void ResetGraph()
 {
     MapM.ResetGraph();
 }
Exemplo n.º 13
0
    public virtual void Dead()
    {
        if (m_isDead)
        {
            return;
        }
        //Debug.Log(this + " dead" + "," + SceneID);
        //炮弹兵死亡
        if (m_Core.m_type == LifeMType.SOLDIER)
        {
            CmCarbon.AddDiePlayerSoldier(m_Core, GetMapPos());
            //Debug.Log("add mana" + m_SceneID + gameObject);
            CmCarbon.AddGodSkillMana(!m_Core.m_IsPlayer, ConfigM.GetSoldierDeadMana());
            if (m_Core.m_IsPlayer == false)
            {
                GodSkillWnd gsw = WndManager.FindDialog <GodSkillWnd>();
                if (gsw != null)
                {
                    gsw.SetCurMana(CmCarbon.GetGodSkillMana(true));
                }
            }
        }
        //建筑物死亡
        if (m_Core.m_type == LifeMType.BUILD)
        {
            CmCarbon.AddDieBuild(m_Core);
            BattleEnvironmentM.ShowSmoke();
            //Debug.Log("add mana" + m_SceneID + gameObject);
            if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.CombatPVE)
            {
                int mana = (m_Attr as BuildAttribute).DeadMana;
                CmCarbon.AddGodSkillMana(!m_Core.m_IsPlayer, mana);
            }
            else
            {
                CmCarbon.AddGodSkillMana(!m_Core.m_IsPlayer, ConfigM.GetBuildDeadMana());
            }

            if (m_Core.m_IsPlayer == false)
            {
                GodSkillWnd gsw = WndManager.FindDialog <GodSkillWnd>();
                if (gsw != null)
                {
                    gsw.SetCurMana(CmCarbon.GetGodSkillMana(true));
                }
            }
        }
        m_isDead = true;
        BeforeDead();
        //SkillEffects._instance.LoadEffect("effect/prefab/", "1052061",transform.position,1f);
        LifeMCamp   Camp     = (m_Core.m_Camp == LifeMCamp.ATTACK) ? LifeMCamp.DEFENSE :LifeMCamp.ATTACK;
        List <Life> RoleList = new List <Life>();

        CM.SearchLifeMListInBoat(ref RoleList, LifeMType.SOLDIER | LifeMType.SUMMONPET, Camp);
        AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_TD), RoleList);
        MapM.EmptyRoleStations(m_SceneID, m_Core.m_type);
        CM.ExitCombat(m_Core, m_SceneID);


        DeadEffect();

        if (this is Building1300)
        {
        }
        else
        {
            Destroy();
        }
    }