Exemple #1
0
 public override void update(float elapsedTime)
 {
     if (mCurTimeCount >= 0.0f)
     {
         mCurTimeCount = mCurTimeCount + elapsedTime;
         if (mCurTimeCount >= 1.0f)
         {
             mCurTimeCount  = 0.0f;
             mCurSpeed      = mSpeedInSecond;
             mSpeedInSecond = 0.0f;
             if (!MathUtility.isFloatZero(mCurSpeed))
             {
                 mRemainTime = (mTotalSize - getDownloadedSize()) / mCurSpeed;
             }
             else
             {
                 mRemainTime = 0.0f;
             }
         }
     }
     if (mLastDownloadingTime >= 0.0f)
     {
         mLastDownloadingTime = mLastDownloadingTime + elapsedTime;
         if (mLastDownloadingTime >= mDownloadTimeOut)
         {
             logError("网络异常!");
             mState = UPGRADE_STATE.US_NONE;
             setCancel(true, false);
             mLastDownloadingTime = 0.0f;
         }
     }
 }
Exemple #2
0
 private bool EffectEnd()
 {
     upgradeState = UPGRADE_STATE.GAUGE_DESCEND;
     GlobalVars.Instance.PlayOneShot(sndGagueDown);
     AutoFunctionManager.Instance.AddAutoFunction(new AutoFunction(GagueDescend, 10f));
     return(false);
 }
Exemple #3
0
 public void requestDownloadVersion()
 {
     mState = UPGRADE_STATE.US_DOWNLOADING_VERSION;
     mEditorCore.sendDelayEvent(CORE_EVENT_TYPE.CET_START_DOWNLOAD_VERSION);
     // 开始下载版本文件
     repuestDownload(CommonDefine.VERSION, 0);
 }
Exemple #4
0
 public override void OnPopup()
 {
     rc         = new Rect((GlobalVars.Instance.ScreenRect.width - size.x) / 2f, (GlobalVars.Instance.ScreenRect.height - size.y) / 2f, size.x, size.y);
     txtMainClr = GlobalVars.Instance.txtMainColor;
     resetUseProps();
     curItem      = -1;
     strErr       = string.Empty;
     upgradeState = UPGRADE_STATE.NONE;
 }
Exemple #5
0
 private bool GagueDescend()
 {
     gagueYValue += Time.deltaTime * gagueRiseSpeed;
     if (gagueYValue > (float)(uiGagueBG.texImage.height + 1))
     {
         gagueYValue  = (float)(uiGagueBG.texImage.height + 1);
         upgradeState = UPGRADE_STATE.SELECT;
         return(true);
     }
     return(false);
 }
Exemple #6
0
 private void StartUpgrade()
 {
     gaguePercent   = 0f;
     gagueGoalMinus = 50f;
     SetGagueGoal(gagueUpProgress: true);
     curGagueSpeed = gagueStartSpeed;
     gagueYValue   = (float)(uiGagueBG.texImage.height + 1);
     upgradeState  = UPGRADE_STATE.GAUGE_RISE;
     AutoFunctionManager.Instance.AddAutoFunction(new AutoFunction(GagueRise, 10f));
     GlobalVars.Instance.PlayOneShot(sndGagueUp);
 }
Exemple #7
0
 private bool GagueRise()
 {
     gagueYValue -= Time.deltaTime * gagueRiseSpeed;
     if (gagueYValue < 0f)
     {
         gagueYValue  = 0f;
         upgradeState = UPGRADE_STATE.GAUGE_PROGRESS;
         GlobalVars.Instance.PlayOneShot(sndUpgradeStart);
         return(true);
     }
     return(false);
 }
Exemple #8
0
 public DownloadManager(string name)
     : base(name)
 {
     mDownloadingFileList = new Dictionary <string, FileWrap>();
     mDownloadedList      = new Dictionary <string, FileWrap>();
     mRemoteFileList      = new Dictionary <string, DownloadFileInfo>();
     mLocalFileList       = new Dictionary <string, DownloadFileInfo>();
     mModifiedList        = new Dictionary <string, DownloadFileInfo>();
     mIgnorePathList      = new List <string>();
     mCurDownloading      = null;
     mCancel = false;
     mState  = UPGRADE_STATE.US_NONE;
     mIgnorePathList.Add("dndl_Data/StreamingAssets/CustomSound/RaceSound");
     mCurTimeCount        = -1.0f;
     mCurSpeed            = 0.0f;
     mSpeedInSecond       = 0.0f;
     mTotalSize           = 0.0f;
     mDownloadedSize      = 0;
     mRemainTime          = 0.0f;
     mDownloadTimeOut     = 120.0f;
     mLastDownloadingTime = -1.0f;
 }
Exemple #9
0
 public void setState(UPGRADE_STATE state)
 {
     mState = state;
 }
Exemple #10
0
 public void UpgradeResultSetting(bool result)
 {
     upgradeState  = UPGRADE_STATE.GAUGE_END;
     curGagueSpeed = gagueMaxSpeed * 2f;
     isGagueUp     = result;
 }
Exemple #11
0
    public override bool DoDialog()
    {
        bool result = false;

        TextureUtil.DrawTexture(new Rect(0f, 0f, (float)texUpgradeBG.width, (float)texUpgradeBG.height), texUpgradeBG);
        bubbleEffect.Draw();
        myUpgradeItems = MyInfoManager.Instance.GetItemsByCat(0, 7, 0);
        RemoveNotUseItem();
        DoDoctorText();
        DoEnergyTank();
        Vector2 pos = new Vector2(size.x / 2f, 15f);

        LabelUtil.TextOut(pos, StringMgr.Instance.Get("ITEM_UPGRADE").ToUpper(), "BigLabel", txtMainClr, GlobalVars.txtEmptyColor, TextAnchor.UpperCenter);
        TItem template = upgradee.Template;

        DoItem(crdPanelItem, upgradee);
        if (strErr.Length > 0)
        {
            float x = crdPanelUpgrade.x + crdPanelUpgrade.width / 2f - 90f;
            float y = crdPanelUpgrade.y + crdPanelUpgrade.height / 2f - 30f;
            GUI.Label(new Rect(x, y, 210f, 60f), strErr, "MiniLabel");
        }
        else if (curTier >= 0)
        {
            TextureUtil.DrawTexture(new Rect(734f, 143f, 90f, 90f), texQuestion, ScaleMode.StretchToFill);
        }
        else
        {
            UpgradeSelector((int)template.upgradeCategory);
        }
        if (bProgess)
        {
            if (upgradeState == UPGRADE_STATE.GAUGE_RISE)
            {
                GUI.enabled = false;
            }
            if (GlobalVars.Instance.MyButton(crdBtnUpgrade, string.Empty, "UpgradeCancel") || GlobalVars.Instance.IsEscapePressed())
            {
                GlobalVars.Instance.StopSound();
                AutoFunctionManager.Instance.DeleteAllAutoFunction();
                EffectEnd();
                bProgess = false;
                MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("ITEMUPGRADE_CANCELED"));
            }
            if (upgradeState == UPGRADE_STATE.GAUGE_RISE)
            {
                GUI.enabled = true;
            }
        }
        else
        {
            if (!IsEnableUpgradeButton() || upgradeState >= UPGRADE_STATE.WAIT)
            {
                GUI.enabled = false;
            }
            if (GlobalVars.Instance.MyButton(crdBtnUpgrade, string.Empty, "UpgradeStart") && CanUpgradeXpNLv())
            {
                StartUpgrade();
                bProgess = true;
            }
            if (!IsEnableUpgradeButton() || upgradeState >= UPGRADE_STATE.WAIT)
            {
                GUI.enabled = true;
            }
        }
        int num = myUpgradeItems.Length;

        if (num > 0)
        {
            int num2 = 4;
            int num3 = num / num2;
            if (num % num2 > 0)
            {
                num3++;
            }
            float num4 = crdItem.x * (float)num2;
            if (num2 > 1)
            {
                num4 += (float)((num2 - 1) * 2);
            }
            float num5 = crdItem.y * (float)num3;
            if (num3 > 1)
            {
                num5 += (float)((num3 - 1) * 4);
            }
            Rect position = new Rect(crdItemStart.x, crdItemStart.y, crdItem.x, crdItem.y);
            scrollPosition = GUI.BeginScrollView(viewRect: new Rect(crdItemStart.x, crdItemStart.y, crdItemSlotList.width - 20f, num5), position: crdItemSlotList, scrollPosition: scrollPosition, alwaysShowHorizontal: false, alwaysShowVertical: false);
            int num6 = 0;
            int num7 = 0;
            while (num6 < num && num7 < num3)
            {
                position.y = crdItemStart.y + (float)num7 * crdItem.y;
                int num8 = 0;
                while (num6 < num && num8 < num2)
                {
                    position.x = crdItemStart.x + (float)num8 * (crdItem.x + 2f);
                    GUI.BeginGroup(position);
                    TItem  template2 = myUpgradeItems[num6].Template;
                    string str       = "BtnItem";
                    if (template2.season == 2)
                    {
                        str = "BtnItem2";
                    }
                    if (GlobalVars.Instance.MyButton(crdItemBtn, new GUIContent(string.Empty, myUpgradeItems[num6].Seq.ToString()), str))
                    {
                        if (upgradeState == UPGRADE_STATE.NONE)
                        {
                            upgradeState = UPGRADE_STATE.SELECT;
                        }
                        strErr  = string.Empty;
                        curItem = num6;
                    }
                    if (tooltip.ItemSeq == myUpgradeItems[num6].Seq.ToString())
                    {
                        if (position.x < 400f)
                        {
                            ltTooltip = new Vector2(position.x + position.width + 5f, position.y);
                        }
                        else
                        {
                            ltTooltip = new Vector2(position.x - tooltip.size.x - 5f, position.y);
                        }
                    }
                    LabelUtil.TextOut(crdItemName, template2.Name, "MiniLabel", txtMainClr, GlobalVars.txtEmptyColor, TextAnchor.UpperLeft);
                    DrawItemIcon(crdIcon: new Rect(crdItemBtn.x + 4f, crdItemBtn.y + 13f, (float)(int)((float)template2.CurIcon().width * 0.9f), (float)(int)((float)template2.CurIcon().height * 0.9f)), item: myUpgradeItems[num6]);
                    LabelUtil.TextOut(crdRemain, myUpgradeItems[num6].GetRemainString(), "MiniLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleRight);
                    if (num6 == curItem)
                    {
                        TUpgrade tUpgrade = (TUpgrade)template2;
                        curTier = tUpgrade.tier;
                        GUI.Box(new Rect(crdItemBtn.x - 3f, crdItemBtn.y - 3f, crdItemBtn.width + 6f, crdItemBtn.height + 6f), string.Empty, "BtnItemF");
                        if (strErr == string.Empty)
                        {
                            strErr = CanUseUpgrader(tUpgrade);
                        }
                    }
                    GUI.EndGroup();
                    num6++;
                    num8++;
                }
                num7++;
            }
            GUI.EndScrollView();
        }
        else
        {
            float x2 = crdUpgradeItemListBg.x + crdUpgradeItemListBg.width / 2f;
            float y2 = crdUpgradeItemListBg.y + crdUpgradeItemListBg.height / 2f;
            LabelUtil.TextOut(new Vector2(x2, y2), StringMgr.Instance.Get("NOTHING_UPGRADER"), "BigLabel", Color.white, GlobalVars.txtEmptyColor, TextAnchor.MiddleCenter);
        }
        Rect rc = new Rect(size.x - 50f, 10f, 34f, 34f);

        if (GlobalVars.Instance.MyButton(rc, string.Empty, "BtnClose") || GlobalVars.Instance.IsEscapePressed())
        {
            bProgess = false;
            result   = true;
            GlobalVars.Instance.StopSound();
            GlobalVars.Instance.PlayOneShot(GlobalVars.Instance.sndButtonClick);
            AutoFunctionManager.Instance.DeleteAllAutoFunction();
        }
        DoTooltip(new Vector2(base.rc.x, base.rc.y));
        DoGagueEffect();
        if (!ContextMenuManager.Instance.IsPopup)
        {
            WindowUtil.EatEvent();
        }
        return(result);
    }
Exemple #12
0
 public override void Update()
 {
     focusTime += Time.deltaTime;
     uiGagueLightning.Update();
     if (upgradeState >= UPGRADE_STATE.GAUGE_PROGRESS && upgradeState <= UPGRADE_STATE.GAUGE_END)
     {
         if (upgradeState == UPGRADE_STATE.GAUGE_PROGRESS)
         {
             curGagueSpeed += Time.deltaTime * gagueAcceleration;
             if (curGagueSpeed > gagueMaxSpeed)
             {
                 curGagueSpeed = gagueMaxSpeed;
                 upgradeState  = UPGRADE_STATE.WAIT;
                 reqprop       = getSelectedProp();
                 Item item = myUpgradeItems[curItem];
                 if (item != null)
                 {
                     CSNetManager.Instance.Sock.SendCS_UPGRADE_ITEM_REQ(upgradee.Seq, upgradee.Code, item.Seq, item.Code, reqprop);
                 }
                 else
                 {
                     MessageBoxMgr.Instance.AddMessage(StringMgr.Instance.Get("NOT_FOUND_UPGRADER"));
                 }
                 bProgess = false;
             }
         }
         if (isGagueUp)
         {
             gaguePercent += Time.deltaTime * curGagueSpeed;
         }
         else
         {
             gaguePercent -= Time.deltaTime * curGagueSpeed;
         }
         if (upgradeState == UPGRADE_STATE.GAUGE_END)
         {
             if (gaguePercent > 100f)
             {
                 gaguePercent = 100f;
                 upgradeState = UPGRADE_STATE.EFFECT;
                 if (GlobalVars.Instance.successUpgradePropID >= 0)
                 {
                     int num = GlobalVars.Instance.successUpgradePropID;
                     successUpgradePropID = GlobalVars.Instance.successUpgradePropID;
                     SystemMsgManager.Instance.ShowMessage(string.Format(StringMgr.Instance.Get("ITEMUPGRADE_SUCCESS"), StringMgr.Instance.Get(UpgradePropNames[num])));
                     GlobalVars.Instance.successUpgradePropID = -1;
                     GlobalVars.Instance.PlayOneShot(sndUpgradeSuccess);
                     AutoFunctionManager.Instance.AddAutoFunction(new AutoFunction(null, 2.3f, 1E-05f, EffectEnd));
                 }
             }
             if (gaguePercent < 0f)
             {
                 gaguePercent = 0f;
                 upgradeState = UPGRADE_STATE.EFFECT;
                 failEffect.ResetTime();
                 failEffect2.SetEndTime();
                 failEffect3.SetEndTime();
                 SystemMsgManager.Instance.ShowMessage(StringMgr.Instance.Get("ITEMUPGRADE_FAIL"));
                 GlobalVars.Instance.PlayOneShot(sndUpgradeFail);
                 AutoFunctionManager.Instance.AddAutoFunction(new AutoFunction(null, 0.4f, 1E-05f, FailEffect2));
                 AutoFunctionManager.Instance.AddAutoFunction(new AutoFunction(null, 0.5f, 1E-05f, FailEffect3));
                 AutoFunctionManager.Instance.AddAutoFunction(new AutoFunction(null, 2.3f, 1E-05f, EffectEnd));
             }
         }
         else if (isGagueUp && nextGagueGoal < gaguePercent)
         {
             if (gaguePercent > 99f)
             {
                 gaguePercent = 99f;
             }
             SetGagueGoal(gagueUpProgress: false);
         }
         else if (!isGagueUp && nextGagueGoal > gaguePercent)
         {
             SetGagueGoal(gagueUpProgress: true);
         }
     }
     if (upgradeState == UPGRADE_STATE.EFFECT)
     {
         successRotate.Update();
         successEffect.Update();
         failEffect.Update();
         failEffect2.Update();
         failEffect3.Update();
     }
     bubbleEffect.Update();
 }