Beispiel #1
0
 public override void Init()
 {
     base.Init();
     if (Entity.buildingVO.trapBuildingVO == null)
     {
         Entity.buildingVO.trapBuildingVO = new TrapBuildingVO()
         {
             broken = false
         };
     }
     if (Entity.buildingVO.trapBuildingVO.broken)
     {
         enabled = false;
         Entity.view.SwitchBody(2);//broken view
     }
     else
     {
         enabled = true;
         Entity.view.SwitchBody(1);
     }
     if (GameWorld.Instance.worldType == WorldType.Home || GameWorld.Instance.worldType == WorldType.Visit)
     {
         enabled = false;
         EventDispather.AddEventListener(GameEvents.TRAP_REFILL, OnTrapRefill);
     }
     else
     {
         Entity.HideEntity(); //  陷阱初始不可见
     }
 }
Beispiel #2
0
    /// <summary>
    /// 显示回放的UI
    /// </summary>
    public void ShowReplayUI()
    {
        UIMananger.Instance.CloseWinByType(UICloseOrHideType.CLOSE_WORLD_TYPE_REPLAY);
        UIPanel  panel;
        UISprite sprite;
        //回放防御者信息
        GameObject defenderPanel = UIMananger.Instance.ShowWin("PLG_FightReplay", "UIFightReplayDefenderPanel");

        sprite = defenderPanel.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(0, 0, 1, 1), new Vector4(0, sprite.width, -sprite.height, 0));
        defenderPanel.GetComponent <UIFightReplayDefenderWnd>().UpdateDefenderInfo(null, null);
        //回放攻击者信息
        GameObject attackerPanel = UIMananger.Instance.ShowWin("PLG_FightReplay", "UIFightReplayAttackerPanel");

        sprite = attackerPanel.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(1, 1, 1, 1), new Vector4(-sprite.width, 0, -sprite.height, 0));
        attackerPanel.GetComponent <UIFightReplayAttackerWnd>().UpdateAttackerInfo(null, null);
        //回放战斗面板
        GameObject replayPanel = UIMananger.Instance.ShowWin("PLG_FightReplay", "UIFightReplayPanel");

        panel = replayPanel.GetComponent <UIPanel>();
        panel.baseClipRegion = new Vector4(0, 0, 0, 150);
        replayPanel.transform.localPosition = new Vector3(0, -(Constants.UI_HEIGHT - panel.baseClipRegion.w) * 0.5f, 0);
        panel.clipping = UIDrawCall.Clipping.ConstrainButDontClip;
        PanelUtil.SetPanelAnchors(panel, UIMananger.Instance.uiLayer.transform, new Vector4(0, 1, 0, 0), new Vector4(0, 0, 0, panel.baseClipRegion.w));
        replayPanel.GetComponent <UIFightReplayWnd>().SetFightData();
        //回放倒计时
        GameObject backTimeWin = UIMananger.Instance.ShowWin("PLG_FightReplay", "UIFightReplayBackTimePanel");

        sprite = backTimeWin.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(0.5f, 0.5f, 1, 1), new Vector4(-sprite.width * 0.5f, sprite.width * 0.5f, -sprite.height, 0));
        backTimeWin.GetComponent <UIFightReplayBackTimeWnd>().SetFightReplayTime();
        EventDispather.AddEventListener(GameEvents.BATTLE_END, OnFightRealEnd);
    }
 public int storage;//剩余量
 public override void Init()
 {
     if (GameWorld.Instance.worldType != WorldType.Home || Entity.buildingVO.buildingStatus != BuildingVO.BuildingStatus.On)
     {
         enabled = false;
     }
     else
     {
         EventDispather.AddEventListener(GameEvents.RESOURCE_CHANGE, OnResourceChange);
     }
     UpdateState(DateTimeUtil.UnixTimestampMSToDateTime(Entity.buildingVO.resourceBuildingVO.lastGatherTime), storage);
     showingGatherIcon = false;
     base.Init();
 }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < uilist.Length; i++)
        {
            string name = ((GameObject)uilist[i]).name;

            ui[name] = (GameObject)uilist[i];
        }

        ShowSingleUI("ControllUI");

        EventDispather.AddEventListener(EventName.UI_SHOW, OnShowUI);
        EventDispather.AddEventListener(EventName.UI_SHOW_SINGLE, OnShowUI);

        SoundManager.PlayMusic(3);
    }
Beispiel #5
0
    /// <summary>
    /// 显示战斗的UI
    /// </summary>
    public void ShowBattleUI()
    {
        UIMananger.Instance.CloseWinByType(UICloseOrHideType.CLOSE_WORLD_TYPE_BATTLE);
        UIPanel  panel;
        UISprite sprite;
        //战斗界面下方窗体
        GameObject fightPanel = UIMananger.Instance.ShowWin("PLG_Fight", "UIFightPanel");

        panel = fightPanel.GetComponent <UIPanel>();
        panel.baseClipRegion = new Vector4(0, 0, 0, 150);
        fightPanel.transform.localPosition = new Vector3(0, -(Constants.UI_HEIGHT - panel.baseClipRegion.w) * 0.5f, 0);
        panel.clipping = UIDrawCall.Clipping.ConstrainButDontClip;
        PanelUtil.SetPanelAnchors(panel, UIMananger.Instance.uiLayer.transform, new Vector4(0, 1, 0, 0), new Vector4(0, 0, 0, panel.baseClipRegion.w));
        fightPanel.GetComponent <UIFightWnd>().SetFightData();
        //战斗内部信息
        GameObject fightInfo = UIMananger.Instance.ShowWin("PLG_Fight", "UIFightInfoPanel");

        sprite = fightInfo.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(0, 0, 1, 1), new Vector4(0, sprite.width, -sprite.height, 0));
        fightInfo.GetComponent <UIFightInfoWnd>().UpdateFightInfo(null, null);
        //战斗中掠夺资源
        GameObject personMoneyWin = UIMananger.Instance.ShowWin("PLG_MainUI", "UIPersonMoneyPanel");

        sprite = personMoneyWin.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(1, 1, 1, 1), new Vector4(-sprite.width, 0, -sprite.height, 0));
        personMoneyWin.GetComponent <UIPersonMoneyWnd>().SetPlayerMoney(OwnerType.Attacker);
        //战斗计时
        GameObject backTimeWin = UIMananger.Instance.ShowWin("PLG_Fight", "UIFightBackTimePanel");

        sprite = backTimeWin.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(0.5f, 0.5f, 1, 1), new Vector4(-sprite.width * 0.5f, sprite.width * 0.5f, -sprite.height, 0));
        backTimeWin.GetComponent <UIFightBackTimeWnd>().SetTimeAndType(BACK_TIME_FIGHT_PREPARE, 10);
        EventDispather.AddEventListener(GameEvents.BATTLE_SPAWN, OnFightRealBegin);
        EventDispather.AddEventListener(GameEvents.BATTLE_END, OnFightRealEnd);
        hasUseArmy = false;
    }
Beispiel #6
0
    public override void Init()
    {
        base.Init();

        EventDispather.AddEventListener(GameEvents.SKILL_UP, OnSkillUpEvent);
    }