Пример #1
0
    public void OnResetButton()
    {
        RoleInfo role_info = LobbyClient.Instance.CurrentRole;

        if (null != role_info)
        {
            UserInfo user = role_info.GetPlayerSelfInfo();
            if (null != user)
            {
                ExpeditionPlayerInfo e = role_info.GetExpeditionInfo();
                if (null != e)
                {
                    if (e.Schedule > 0)
                    {
                        CharacterProperty property = user.GetActualProperty();
                        GfxSystem.EventChannelForLogic.Publish("ge_expedition_reset", "lobby", 1000, 1000, 0, 0, true, false);
                    }
                    else
                    {
                        ArkCrossEngine.MyAction <int> Func = HandleDialog;
                        string CHN_CONFIRM = StrDictionaryProvider.Instance.GetDictString(4); //确定
                        string CHN_CANCEL  = StrDictionaryProvider.Instance.GetDictString(9); //取消
                        string CHN_DESC    = StrDictionaryProvider.Instance.GetDictString(460);
                        LogicSystem.EventChannelForGfx.Publish("ge_show_dialog", "ui", CHN_DESC, null, CHN_CONFIRM, CHN_CANCEL, Func, false);
                    }
                }
            }
        }
    }
Пример #2
0
    //根据打到的当前关卡设置位置
    private void TransTreasureMapPosition()
    {
        RoleInfo role = LobbyClient.Instance.CurrentRole;

        if (role == null)
        {
            return;
        }
        ExpeditionPlayerInfo ep_info = role.GetExpeditionInfo();

        if (ep_info != null)
        {
            int shedule = ep_info.Schedule;
            //在前七关之前需要移动显示的位置
            if (shedule < 7 && shedule < buttonArr.Length && null != buttonArr[shedule])
            {
                float delta = buttonArr[shedule].transform.localPosition.x - originalPos.x;
                if (goMap != null)
                {
                    UnityEngine.Vector3 pos = goMap.transform.localPosition;
                    goMap.transform.localPosition = new UnityEngine.Vector3(pos.x - delta, pos.y, pos.z);
                }
            }
        }
    }
Пример #3
0
    //計算倒計時并顯示
    public void CalCountDown()
    {
        RoleInfo role_info = LobbyClient.Instance.CurrentRole;

        if (role_info != null)
        {
            double currentTime           = ArkCrossEngine.TimeUtility.CurTimestamp;
            ExpeditionPlayerInfo ep_info = role_info.GetExpeditionInfo();
            if (ep_info != null)
            {
                double startTime = ep_info.LastResetTimestamp;
                int    totleTime = (int)ep_info.ExpeditionResetIntervalTime;
                int    leftTime  = totleTime - (int)(currentTime - startTime);
                leftTime = leftTime < 0 ? 0 : leftTime;
                int    hour      = leftTime / 3600;
                int    munite    = (leftTime % 3600) / 60;
                int    second    = leftTime % 60;
                string CHN       = StrDictionaryProvider.Instance.GetDictString(451);
                string CHN_RESET = StrDictionaryProvider.Instance.GetDictString(452);
                string res       = string.Format(CHN, hour, munite, second);
                if (lblCd != null)
                {
                    lblCd.text = res;
                }
                if (leftTime <= 0)
                {
                    string str = string.Format(CHN_RESET, 1);
                    if (lblReset != null)
                    {
                        lblReset.text = str;
                    }
                    if (btnReset != null)
                    {
                        btnReset.isEnabled = true;
                    }
                }
                else
                {
                    string str = string.Format(CHN_RESET, 0);
                    if (lblReset != null)
                    {
                        lblReset.text = str;
                    }
                    if (btnReset != null)
                    {
                        btnReset.isEnabled = false;
                    }
                }
            }
        }
    }
Пример #4
0
    //点击按钮显示远征二级界面信息 或者领取奖励
    public void ShowLevelInfo(int index)
    {
        RoleInfo role_info = LobbyClient.Instance.CurrentRole;

        if (role_info != null)
        {
            m_CurrentClickIndex = index;
            ExpeditionPlayerInfo ep_info = role_info.GetExpeditionInfo();
            if (ep_info != null)
            {
                //角色已经死亡、且点击的不是宝箱则弹出提示对话框
                if (ep_info.Hp <= 0 && index == ep_info.Schedule)
                {
                    string CHN_DESC = StrDictionaryProvider.Instance.GetDictString(453);
                    string CHN_CON  = StrDictionaryProvider.Instance.GetDictString(4);
                    ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_show_dialog", "ui", CHN_DESC, CHN_CON, null, null, null, false);
                    return;
                }
                int currentSchedule = ep_info.Schedule;
                if (index < currentSchedule)
                {
                    LogicSystem.EventChannelForGfx.Publish("ge_ui_connect_hint", "ui", false, true);
                    GfxSystem.EventChannelForLogic.Publish("ge_expedition_award", "lobby", index);
                    return;
                }
            }
        }
        m_LevelIndex = index;
        DestroyChildrenInGrid();
        if (goLevelInfo != null)
        {
            NGUITools.SetActive(goLevelInfo, true);
        }
        if (role_info != null)
        {
            //获取远征信息
            ExpeditionPlayerInfo exPlayInfo = role_info.GetExpeditionInfo();
            if (exPlayInfo != null)
            {
                WorldSystem.Instance.ExpeditionErrorCheck();
                if (index < exPlayInfo.Tollgates.Length || exPlayInfo.Tollgates[index] != null)
                {
                    ExpeditionPlayerInfo.TollgateData levelData = exPlayInfo.Tollgates[index];
                    //NPC
                    if (levelData.Type == EnemyType.ET_Boss || levelData.Type == EnemyType.ET_Monster)
                    {
                        int numLimit = 0;
                        for (int i = 0; i < levelData.EnemyList.Count; ++i)
                        {
                            int monsterId = levelData.EnemyList[i];
                            int attrId    = -1;
                            if (i < levelData.EnemyAttrList.Count)
                            {
                                attrId = levelData.EnemyAttrList[i];
                            }
                            if (goSlot == null && uiGrid == null)
                            {
                                break;
                            }
                            UnityEngine.GameObject go = NGUITools.AddChild(uiGrid.gameObject, goSlot);
                            if (go == null)
                            {
                                continue;
                            }
                            UITreasureSlot uiTsSlot = go.GetComponent <UITreasureSlot>();
                            if (uiTsSlot != null)
                            {
                                uiTsSlot.SetLevelInfo(monsterId, attrId);
                            }
                            if (++numLimit >= 4)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        //Player
                        foreach (ExpeditionImageInfo enemy_info in levelData.UserImageList)
                        {
                            if (goSlot == null && uiGrid == null)
                            {
                                break;
                            }
                            UnityEngine.GameObject go = NGUITools.AddChild(uiGrid.gameObject, goSlot);
                            if (go == null)
                            {
                                continue;
                            }
                            UITreasureSlot uiTsSlot = go.GetComponent <UITreasureSlot>();
                            if (uiTsSlot != null)
                            {
                                if (enemy_info.FightingScore <= 0)
                                {
                                    int min = (int)(role_info.FightingScore - role_info.FightingScore * 0.2f);
                                    int max = (int)(role_info.FightingScore + role_info.FightingScore * 0.2f);
                                    int rnd = CrossEngineHelper.Random.Next(min, max);
                                    enemy_info.FightingScore = rnd;
                                }
                                uiTsSlot.SetLevelInfo(enemy_info);
                            }
                        }
                    }
                }
                if (uiGrid != null)
                {
                    uiGrid.Reposition();
                }
            }
        }
    }
Пример #5
0
    //初始化远征界面
    private void InitTreasureMap()
    {
        if (goTreasureButton != null && goMap != null && !m_IsInitializedMap)
        {
            for (int index = 1; index <= 12; ++index)
            {
                UnityEngine.GameObject go = NGUITools.AddChild(goMap, goTreasureButton);
                if (go != null)
                {
                    float xPos = (index - 1) * DeltaX + originalPos.x;
                    float yPos = index % 2 == 0 ? DownPosY : UpPosY;
                    go.transform.localPosition = new UnityEngine.Vector3(xPos, yPos, 0);
                    go.name = "gk" + index;
                    UIButton uiBtn = go.GetComponent <UIButton>();
                    buttonArr[index - 1] = uiBtn;
                    UITreasureButton tb = go.GetComponent <UITreasureButton>();
                    if (tb != null)
                    {
                        tb.SetLabelNumber(index);
                    }
                }
            }
            m_IsInitializedMap = true;
        }
        RoleInfo role_info = LobbyClient.Instance.CurrentRole;

        if (role_info != null)
        {
            ExpeditionPlayerInfo ep_info = role_info.GetExpeditionInfo();
            if (ep_info != null)
            {
                int currentSchedule = ep_info.Schedule;
                for (int index = 0; index < buttonArr.Length; ++index)
                {
                    if (index < currentSchedule && buttonArr[index] != null)
                    {
                        //小于当前进度的按钮
                        if (index < ep_info.Tollgates.Length && ep_info.Tollgates[index] != null)
                        {
                            if (ep_info.Tollgates[index].IsAcceptedAward)
                            {
                                UITreasureButton tb = buttonArr[index].GetComponent <UITreasureButton>();
                                if (tb != null)
                                {
                                    tb.SetTreasureButtonState(ButtonState.Openned);
                                }
                            }
                            else
                            {
                                UITreasureButton tb = buttonArr[index].GetComponent <UITreasureButton>();
                                if (tb != null)
                                {
                                    tb.SetTreasureButtonState(ButtonState.Finished);
                                }
                            }
                            TweenPosition tweenPos = buttonArr[index].GetComponent <TweenPosition>();
                            if (tweenPos)
                            {
                                Destroy(tweenPos);
                            }
                        }
                    }
                    //大于当前进度
                    if (index > currentSchedule && buttonArr[index] != null)
                    {
                        UITreasureButton tb = buttonArr[index].GetComponent <UITreasureButton>();
                        if (tb != null)
                        {
                            tb.SetTreasureButtonState(ButtonState.Lock);
                        }
                        TweenPosition tweenPos = buttonArr[index].GetComponent <TweenPosition>();
                        if (tweenPos)
                        {
                            Destroy(tweenPos);
                        }
                    }
                    //等于当前进度
                    if (index == currentSchedule && buttonArr[index] != null)
                    {
                        UITreasureButton tb = buttonArr[index].GetComponent <UITreasureButton>();
                        if (tb != null)
                        {
                            tb.SetTreasureButtonState(ButtonState.UnLock);
                        }
                        //重置跳动的位置,以防按钮脱离原来位置
                        UnityEngine.Vector3 fromPos = buttonArr[index].transform.localPosition;
                        if (index % 2 == 0)
                        {
                            fromPos.y = originalPos.y;
                        }
                        else
                        {
                            fromPos.y = DownPosY;
                        }
                        buttonArr[index].transform.localPosition = fromPos;
                        UnityEngine.Vector3 targetPos = buttonArr[index].transform.localPosition + new UnityEngine.Vector3(0, 10f, 0);
                        TweenPosition       tweenPos  = TweenPosition.Begin(buttonArr[index].gameObject, duration, targetPos);
                        tweenPos.animationCurve = animationCureve;
                        tweenPos.style          = UITweener.Style.PingPong;
                    }
                    if (index < currentSchedule)
                    {
                        if (index < spArrowArr.Length && spArrowArr[index] != null)
                        {
                            spArrowArr[index].spriteName = "guan-qian-lu-biao";
                        }
                    }
                    else
                    {
                        if (index < spArrowArr.Length && spArrowArr[index] != null)
                        {
                            spArrowArr[index].spriteName = "guan-qian-lu-biao2";
                        }
                    }
                }
            }
        }
    }
Пример #6
0
    // Update is called once per frame
    void Update()
    {
        try
        {
            RoleInfo role_info = LobbyClient.Instance.CurrentRole;
            if (role_info != null)
            {
                if (lblDiamond != null)
                {
                    lblDiamond.text = role_info.Gold.ToString();
                }
                if (lblMoney != null)
                {
                    lblMoney.text = role_info.Money.ToString();
                }
                if (lblStamina != null)
                {
                    lblStamina.text = role_info.CurStamina + "/" + 120;
                    if (staminaBar != null)
                    {
                        staminaBar.value = role_info.CurStamina / (float)120;
                    }
                }
                ExpeditionPlayerInfo ep_info   = role_info.GetExpeditionInfo();
                UserInfo             user_info = role_info.GetPlayerSelfInfo();
                if (ep_info != null && user_info != null)
                {
                    if (hpBar != null)
                    {
                        hpBar.value = ep_info.Hp / 1000f;
                        int    hpMax = user_info.GetActualProperty().HpMax;
                        int    curhp = (int)((float)ep_info.Hp / 1000f * hpMax);
                        string hpstr = string.Format("{0}/{1}", curhp > hpMax ? hpMax : curhp, hpMax);
                        if (lblHp != null)
                        {
                            lblHp.text = hpstr;
                        }
                    }
                    if (mpBar != null)
                    {
                        mpBar.value = ep_info.Mp / 1000f;
                    }

                    int    mpMax = user_info.GetActualProperty().EnergyMax;
                    int    curMp = (int)((float)ep_info.Mp / 1000f * mpMax);
                    string mpStr = string.Format("{0}/{1}", curMp > mpMax ? mpMax : curMp, mpMax);
                    if (lblMp != null)
                    {
                        lblMp.text = mpStr;
                    }
                    if (lblLevel != null)
                    {
                        lblLevel.text = role_info.Level.ToString();
                    }
                    if (spPortrait != null)
                    {
                        Data_PlayerConfig playerData = PlayerConfigProvider.Instance.GetPlayerConfigById(role_info.HeroId);
                        if (playerData != null)
                        {
                            spPortrait.spriteName = playerData.m_Portrait;
                        }
                    }
                }
            }
        }
        catch (System.Exception ex)
        {
            ArkCrossEngine.LogicSystem.LogErrorFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace);
        }
    }