예제 #1
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);
    }
예제 #2
0
    /// <summary>
    /// 在倒计时时间内直接出兵,战斗开始
    /// </summary>
    /// <param name="eventType"></param>
    /// <param name="obj"></param>
    private void OnFightRealBegin(string eventType, object obj)
    {
        EventDispather.RemoveEventListener(GameEvents.BATTLE_SPAWN, OnFightRealBegin);
        EventDispather.DispatherEvent(BACK_TIME_FIGHT_START);
        GameObject backTimeWin = UIMananger.Instance.ShowWin("PLG_Fight", "UIFightBackTimePanel");
        UISprite   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(2, 180);
    }
예제 #3
0
    private void ShowFightReplayResultWin()
    {
        UIMananger.Instance.CloseWin("UIFightReplayPanel");
        //打开战斗结果面板
        GameObject fightResultWin = UIMananger.Instance.ShowWin("PLG_FightReplay", "UIFightReplayResultPanel");
        UIPanel    panel          = fightResultWin.GetComponent <UIPanel>();

        panel.clipping = UIDrawCall.Clipping.ConstrainButDontClip;
        PanelUtil.SetPanelAnchors(panel, UIMananger.Instance.uiLayer.transform, new Vector4(0, 1, 0, 1), new Vector4(0, 0, 0, 0));
        fightResultWin.GetComponent <UIFightReplayResultWnd>().UpDateFightReplayResultInfo();
    }
예제 #4
0
    public void ShowMyHomeLandUI()
    {
        UIMananger.Instance.CloseWinByType(UICloseOrHideType.CLOSE_WORLD_TYPE_HOME);
        int      panelOffsetX = 0, panelOffsetY = 0;
        UISprite sprite;
        //头部信息
        GameObject playerHead = UIMananger.Instance.ShowWin("PLG_MainUI", "UIPersonHeadPanel");

        sprite = playerHead.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(0, 0, 1, 1), new Vector4(0, sprite.width, -sprite.height, 0));
        playerHead.GetComponent <UIPersonHeadWnd>().UpdatePersonInfo(null, null);
        //显示的资源信息
        GameObject moneyWin = UIMananger.Instance.ShowWin("PLG_MainUI", "UIPersonMoneyPanel");

        sprite = moneyWin.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(1, 1, 1, 1), new Vector4(-sprite.width, 0, -sprite.height, 0));
        moneyWin.GetComponent <UIPersonMoneyWnd>().SetPlayerMoney(OwnerType.Defender);
        //左下角窗体
        panelOffsetX = 5; panelOffsetY = 15;
        GameObject bottomLeftWin = UIMananger.Instance.ShowWin("PLG_MainUI", "UIBottomLeftPanel");

        sprite = bottomLeftWin.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(0, 0, 0, 0), new Vector4(panelOffsetX, panelOffsetX + sprite.width, panelOffsetY, panelOffsetY + sprite.height));
        //右下角窗体
        panelOffsetX = 5; panelOffsetY = 15;
        GameObject bottomRightWin = UIMananger.Instance.ShowWin("PLG_MainUI", "UIBottomRightPanel");

        sprite = bottomRightWin.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(1, 1, 0, 0), new Vector4(-(panelOffsetX + sprite.width), -panelOffsetX, panelOffsetY, panelOffsetY + sprite.height));
        //左边的窗体
        panelOffsetX = 5; panelOffsetY = 15;
        GameObject leftWin = UIMananger.Instance.ShowWin("PLG_MainUI", "UILeftPanel");

        sprite = leftWin.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(0, 0, 0.5f, 0.5f), new Vector4(panelOffsetX, panelOffsetX + sprite.width, -panelOffsetY, -panelOffsetY + sprite.height));
        //右边窗体
        panelOffsetX = 0; panelOffsetY = 0;
        GameObject rightWin = UIMananger.Instance.ShowWin("PLG_MainUI", "UIRightPanel");

        sprite = rightWin.GetComponent <UISprite>();
        PanelUtil.SetPanelAnchors(sprite, UIMananger.Instance.uiLayer.transform, new Vector4(1, 1, 0.5f, 0.5f), new Vector4(panelOffsetX - sprite.width, panelOffsetX, -panelOffsetY - sprite.height * 0.5f, -panelOffsetY + sprite.height * 0.5f));
    }
예제 #5
0
 public void BackTimeOver(int type)
 {
     if (BACK_TIME_FIGHT_PREPARE == type)
     {
         //战斗准备期结束
         GameObject backTimeWin = UIMananger.Instance.ShowWin("PLG_Fight", "UIFightBackTimePanel");
         UISprite   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(2, 180);
         EventDispather.DispatherEvent(BACK_TIME_FIGHT_START);
         //战斗默认开始了
         BattleManager.Instance.StartBattle();
         //倒计时正常结束,不需要监听本事件
         EventDispather.RemoveEventListener(GameEvents.BATTLE_SPAWN, OnFightRealBegin);
     }
     else if (BACK_TIME_FIGHT_OVER == type)
     {
         //战斗结束
         UIMananger.Instance.CloseWin("UIBackTimePanel");
         BattleManager.Instance.ForceBattleEnd();
         ShowFightResultWin();
     }
 }
예제 #6
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;
    }