예제 #1
0
 void InitializeReferences()
 {
     MoneyData    = TheRunGameManager.Instance.MoneyData;
     CrystalsData = TheRunGameManager.Instance.CrystalsData;
     PerksData    = TheRunGameManager.Instance.PerksData;
     PowerupsData = TheRunGameManager.Instance.PowerupsData;
 }
예제 #2
0
 public ActionResult Save(MoneyData viewModel)
 {
     if (ModelState.IsValid)
     {
         homeService.save(viewModel);
     }
     return(RedirectToAction("MoneyListsPartial"));
 }
예제 #3
0
 void Start()
 {
     Rewards  = TheRunGameManager.Instance.RewardsData;
     Crystals = TheRunGameManager.Instance.CrystalsData;
     Perks    = TheRunGameManager.Instance.PerksData;
     Money    = TheRunGameManager.Instance.MoneyData;
     Powerups = TheRunGameManager.Instance.PowerupsData;
 }
예제 #4
0
 void Start()
 {
     moneyData = new MoneyData();
     EventManager.BuyHandler          += Buy;
     EventManager.AddMoneyHandler     += Add;
     EventManager.NearFlyHandler      += () => Add((0, 1));
     EventManager.PostStopGameHandler += () => SaveData();
     LoadData();
 }
예제 #5
0
    public static void SaveMoney(MoneyManager moneyManager)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/money.txt";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        MoneyData data = new MoneyData(moneyManager);

        formatter.Serialize(stream, data);
        stream.Close();
    }
    public static void SaveMoneyData(Money money)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/money.fun";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        //converts the relevant money data into a format that can actually be turned into a bit stream
        MoneyData data = new MoneyData(money);

        formatter.Serialize(stream, data);

        stream.Close();
    }
예제 #7
0
 public void save(MoneyData viewModel)
 {
     using (SkillTreeHomeworkEntities db = new SkillTreeHomeworkEntities())
     {
         AccountBook accountBook = new AccountBook
         {
             Dateee     = viewModel.time,
             Amounttt   = (int)viewModel.money,
             Categoryyy = viewModel.moneyType,
             Remarkkk   = viewModel.remark,
             Id         = Guid.NewGuid()
         };
         db.AccountBook.Add(accountBook);
         db.SaveChanges();
     }
 }
예제 #8
0
 public IEnumerable <MoneyData> getDataLists()
 {
     using (SkillTreeHomeworkEntities db = new SkillTreeHomeworkEntities())
     {
         int i = 0;
         foreach (AccountBook accountBook in db.AccountBook.OrderBy(s => s.Dateee))
         {
             MoneyData moneyData = new MoneyData
             {
                 number    = ++i,
                 moneyType = accountBook.Categoryyy,
                 time      = accountBook.Dateee,
                 money     = accountBook.Amounttt,
             };
             yield return(moneyData);
         }
     }
 }
    // serialize money data
    public bool Serialize(MoneyData data)
    {
        // clear buffer
        Clear();

        // serialize element
        bool result = true;

        result &= Serialize(data.money);

        // failure serialize -> method exit
        if (!result)
        {
            return(false);
        }

        // success serialize -> return result
        return(result);
    }
예제 #10
0
    public static MoneyData LoadMoney()
    {
        string path = Application.persistentDataPath + "/money.txt";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            MoneyData data = formatter.Deserialize(stream) as MoneyData;
            stream.Close();
            return(data);
        }
        else
        {
            Debug.LogError("Save file not found in " + path);
            return(null);
        }
    }
    // deserialize money data
    public bool Deserialize(ref MoneyData data)
    {
        // set deserialize data
        bool result = (GetDataSize() > 0) ? true : false;

        // data read failure -> method exit
        if (!result)
        {
            return(false);
        }

        // set data
        int money = 0;

        // deserialize data
        result &= Deserialize(ref money);

        // input data
        data.money = money;

        // return result
        return(result);
    }
예제 #12
0
    public void CallTakeOver(float x, float y)
    {
        landIndex   = (int)x - 5 * (int)y + 12;
        currentLand = LandManager.lands[landIndex];
        ni          = NetworkClient.serverObjects[NetworkClient.ClientID];

        buildingUI_Text_Title.text   = "";
        buildingUI_Text_Content.text = "";

        Debug.Log("TakeOver");
        if (currentLand.ownerID == "") //빈 땅
        {
            Debug.Log("EMPTY LAND");
            if (ni.GetPlayerManager().getBalance() < currentLand.price.land)
            {
                InsufficientCash();
            }
            else
            {
                buildingUI_Text_Title.text    = "토지를 매매하시겠습니까?";
                buildingUI_Text_Content.text  = "토지 용도 : " + currentLand.name.ToString() + " 부지";
                buildingUI_Text_Content.text += "\n토지 비용 : " + currentLand.price.land.ToString();
                buildingUI_Text_Content.text += "\n토지 구매 이후 통행료 : " + (currentLand.price.land * 4).ToString();
                buildingUI_LinearTimer.color  = ni.GetPlayerManager().getColor();
                buildingUI.SetActive(true);
                timer = true;
                state = State.BuyLand;
            }
        }
        else if (currentLand.ownerID == NetworkClient.ClientID) // 내 땅
        {
            Debug.Log("My Land");
            if (currentLand.status.contract)
            {
                InsufficientCash();
            }
            else if (currentLand.status.building)
            {
                Debug.Log("ask contract");
                if (currentLand.price.contract > ni.GetPlayerManager().getBalance()) // 계약할 돈 부족
                {
                    //ni.GetSocket().Emit("turnOver");
                    NetworkClient.CallTurnOver(ni);
                }
                else // 계약 가능
                {
                    buildingUI_Text_Title.text    = "매매방지 계약을 체결하시겠습니까?";
                    buildingUI_Text_Content.text  = "계약 비용 : " + currentLand.price.contract.ToString();
                    buildingUI_Text_Content.text += "계약 체결 이후 통행료 : " + ((currentLand.totalValue + currentLand.price.contract) * 4).ToString();
                    buildingUI_LinearTimer.color  = ni.GetPlayerManager().getColor();
                    buildingUI.SetActive(true);
                    state = State.Contract;
                    timer = true;
                }
            }
            else if (currentLand.status.land)
            {
                Debug.Log("ask build building");
                if (currentLand.price.building > ni.GetPlayerManager().getBalance())
                {
                    InsufficientCash();
                }
                else // 건물 짓기 가능
                {
                    buildingUI_Text_Title.text    = "건물을 건설하시겠습니까?";
                    buildingUI_Text_Content.text  = "건물 용도 :" + currentLand.name.ToString();
                    buildingUI_Text_Content.text  = "건설 비용 : " + currentLand.price.building.ToString();
                    buildingUI_Text_Content.text += "건물 건설 이후 통행료 : " + ((currentLand.totalValue + currentLand.price.building) * 4).ToString();
                    buildingUI_LinearTimer.color  = ni.GetPlayerManager().getColor();
                    buildingUI.SetActive(true);
                    state = State.Building;
                    timer = true;
                }
            }
        }
        else if (currentLand.ownerID != NetworkClient.ClientID) // 남 땅
        {
            Debug.Log("not my land");
            fee = 4 * currentLand.totalValue;
            if (ni.GetPlayerManager().getBalance() < fee)
            {
                // 자산 매각해도 통행료 못냄->파산
                if (ni.GetPlayerManager().getAssets() < fee)
                {
                    BankruptData bankrupt = new BankruptData();
                    bankrupt.id = NetworkClient.ClientID;
                    ni.GetSocket().Emit("GoBankrupt", new JSONObject(JsonUtility.ToJson(bankrupt)));
                }
                else
                {
                    // 매각 시작
                    for (int i = 0; i < LandManager.lands.Length; i++)
                    {
                        if (LandManager.lands[i].ownerID == NetworkClient.ClientID)
                        {
                            LandManager.lands[i].land.GetComponent <Outline>().OnEnable();
                            LandManager.lands[i].land.GetComponent <Outline>().UpdateMaterialProperties();
                        }
                    }

                    MoneyData moneyData = new MoneyData();
                    moneyData.cost        = fee;
                    moneyData.senderID    = NetworkClient.ClientID;
                    moneyData.receiverID  = currentLand.ownerID;
                    TollFeeData_AfterSell = moneyData;

                    state = State.Sell;

                    int insufficientAmount = fee - ni.GetPlayerManager().getBalance();
                    sellUI_Text.text = insufficientAmount.ToString();
                    sellUI.SetActive(true);

                    buildingUI_Text_Title.text    = "해당 토지를 매각하시겠습니까?";
                    sellTimerUI_LinearTimer.color = ni.GetPlayerManager().getColor();
                    sellTimerUI.SetActive(true);
                    sellTimer = true;
                }
            }
            else
            {
                MoneyData moneyData = new MoneyData();
                moneyData.cost       = fee;
                moneyData.senderID   = NetworkClient.ClientID;
                moneyData.receiverID = currentLand.ownerID;
                int currentBalance = ni.GetPlayerManager().getBalance();
                ni.GetSocket().Emit("updateBalance", new JSONObject(JsonUtility.ToJson(moneyData)));

                currentBalance -= fee;

                // 인수할래? UI 띄우기
                int cost = currentLand.totalValue * 2;
                if (currentBalance < cost)
                {
                    InsufficientCash();
                }
                else
                {
                    buildingUI_Text_Title.text   = "해당 토지를 인수하시겠습니까?";
                    buildingUI_Text_Content.text = "인수 비용 : " + cost.ToString();
                    buildingUI_LinearTimer.color = ni.GetPlayerManager().getColor();
                    buildingUI.SetActive(true);
                    timer = true;
                    state = State.Acquire;
                }
            }
        }
    }
예제 #13
0
    void Update()
    {
        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, 10.0f) && Input.GetMouseButtonDown(0))
        {
            if (!IsPointerOverUIObject(Input.mousePosition))
            {
                if (hit.collider.tag == "Land" && NetworkClient.serverObjects[NetworkClient.ClientID].IsMyTurn())
                {
                    string str = hit.collider.gameObject.name;
                    str         = str.Substring(8);
                    clickedLand = int.Parse(str) - 1;
                    if (state == State.Sell) // 매각 상태일 때만 buildingUI 띄움
                    {
                        buildingUI.SetActive(true);
                    }
                    // 게임중 Land 클릭 시 상세 정보 보여주기?
                }
            }
        }

        // buildingUI timer -> 토지 구입, 빌딩 건설, 계약 체결, 매매 등
        if (timer)
        {
            if (_time < waitTime)
            {
                _time += Time.deltaTime;
                buildingUI_LinearTimer.fillAmount = (waitTime - _time) / waitTime;
                if (buildingUI.GetComponent <ButtonControler>().clicked)
                {
                    userInput = buildingUI.GetComponent <ButtonControler>().result;
                }
            }
            else
            {
                buildingUI.GetComponent <ButtonControler>().clicked = true;
            }
        }

        // 매각 타이머
        if (sellTimer)
        {
            if (_sellTime < sellWaitTime)
            {
                _sellTime += Time.deltaTime;
                sellTimerUI_LinearTimer.fillAmount = (sellWaitTime - _sellTime) / sellWaitTime;
                if (buildingUI.GetComponent <ButtonControler>().clicked)
                {
                    userInput = buildingUI.GetComponent <ButtonControler>().result;
                }
            }
            else
            {
                // 매각 타임 종료
                for (int i = 0; i < LandManager.lands.Length; i++)
                {
                    if (LandManager.lands[i].ownerID == NetworkClient.ClientID)
                    {
                        LandManager.lands[i].land.GetComponent <Outline>().OnDisable();
                    }
                }
                sellTimerUI.SetActive(false);

                _sellTime = 0;
                userInput = false;
                sellTimer = false;
                buildingUI.GetComponent <ButtonControler>().clicked = false;
                buildingUI.GetComponent <ButtonControler>().result  = false;

                buildingUI.SetActive(false);

                if (ni.GetPlayerManager().getBalance() < TollFeeData_AfterSell.cost) //매각 타임이 끝났는데도 통행료 낼 돈을 마련하지 못함 -> 파산
                {
                    Debug.Log("after sell - bankrupt");
                    BankruptData bankrupt = new BankruptData();
                    bankrupt.id = NetworkClient.ClientID;
                    ni.GetSocket().Emit("GoBankrupt", new JSONObject(JsonUtility.ToJson(bankrupt)));
                }
                else
                {
                    Debug.Log("after sell - pay toll fee");
                    MoneyData moneyData = TollFeeData_AfterSell;
                    ni.GetSocket().Emit("updateBalance", new JSONObject(JsonUtility.ToJson(moneyData)));
                    //ni.GetSocket().Emit("turnOver");
                    NetworkClient.CallTurnOver(ni);
                }
            }
        }

        // 공지 타이머 -> 아무것도 할 수 없다는 것 공지
        if (noticeTimer)
        {
            if (_noticeTime < noticeWaitTime)
            {
                _noticeTime += Time.deltaTime;
                buildingUI_LinearTimer.fillAmount = (noticeWaitTime - _noticeTime) / noticeWaitTime;
            }
            else
            {
                noticeTimer = false;
                _noticeTime = 0;

                buildingUI.GetComponent <ButtonControler>().YesButton.gameObject.SetActive(true);
                buildingUI.GetComponent <ButtonControler>().NoButton.gameObject.SetActive(true);

                buildingUI.SetActive(false);

                //ni.GetSocket().Emit("turnOver");
                NetworkClient.CallTurnOver(ni);
            }
        }


        if (buildingUI.GetComponent <ButtonControler>().clicked)
        {
            // 처리 함수 call
            TakeOver(buildingUI.GetComponent <ButtonControler>().result, state);
            _time     = 0;
            userInput = false;
            timer     = false;
            buildingUI.GetComponent <ButtonControler>().clicked = false;
            buildingUI.GetComponent <ButtonControler>().result  = false;
            buildingUI.SetActive(false);
        }

        // 부아앙씨 움직이려면 여기 필요함... 부아앙은 꼭 Update안에 들어있어야해서.. 일단 지금은 똑똑똑씨밖에 없으니 부아앙 코드는 주석처리..

        /*
         * if(positioning)
         * {
         *
         *  // 부아앙
         *  float step = 1f * Time.deltaTime;
         *  ni.transform.position = Vector3.MoveTowards(ni.transform.position, arrivalPoint, step);
         *
         *
         *  // 부아앙은 선택 권한이 없음..
         *  if (Vector3.Distance(ni.transform.position, arrivalPoint) == 0)
         *  {
         *      Debug.Log("arrive");
         *      positioning = false;
         *
         *      if (dist == 0 && ni.IsMyTurn())
         *      {
         *          // 지금 당장은 turn 종료 코드
         *          // 나중에는 여기에 인수 관련 함수 넣으면 됨
         *          Debug.Log("call takeover");
         *          this.CallTakeOver(arrivalPoint.x, arrivalPoint.z);
         *          //Debug.Log("call turnover");
         *      }
         *      else if (dist != 0)
         *      {
         *          Debug.Log("make arrow");
         *          arrowManager.GetComponent<ArrowManager>().MakeArrow(ni,mapSize, arrivalPoint.x, arrivalPoint.z);
         *      }
         *
         * }
         */
    }
예제 #14
0
    void OnTriggerEnter(Collider collidedMoney)
    {
        if (collidedMoney.gameObject.tag == "Money")
        {
            if (payScreenScript.isCash)
            {
                thisObject = collidedMoney.gameObject;
                if (collidedMoney.GetComponent <MoneyData>().hasBeenUsed == false)
                {
                    /* var objGrabbable = thisObject.GetComponent<OVRGrabbable>();
                     * Destroy(objGrabbable);
                     * thisObject.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezePositionY;
                     * thisObject.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
                     * thisObject.transform.position = Vector3.Lerp(thisObject.transform.position, moneyGrabber.position, .02f);
                     * StartCoroutine("DestroyMoney");*/
                    if (!costReached)
                    {
                        scanner.GetComponent <ScannerColliderScriptVRV2>();

                        total = scanner.GetComponent <ScannerColliderScriptVRV2>().total;


                        itemizedText         = scanner.GetComponent <ScannerColliderScriptVRV2>().itemizedText;
                        selfCheckoutMainText = scanner.GetComponent <ScannerColliderScriptVRV2>().selfCheckoutMainText;
                        outputTotalText      = scanner.GetComponent <ScannerColliderScriptVRV2>().outputTotalText;

                        usingCash = true;
                        collidedMoney.GetComponent <MoneyData>().hasBeenUsed = true;

                        moneyData  = collidedMoney.GetComponent <MoneyData>();
                        moneyValue = moneyData.value;
                        var moneyValueConverted = Convert.ToDecimal(moneyValue);
                        currencyType = collidedMoney.name.Replace("(Clone)", " ");

                        newTotal = Decimal.Subtract(total, moneyValueConverted);
                        scanner.GetComponent <ScannerColliderScriptVRV2>().total = newTotal;
                        itemizedText.Append($"\n -{moneyValue:c}");
                        payScreenScript.itemizedText.text = itemizedText.ToString();
                        outputTotalText.Clear();
                        outputTotalText.Append(newTotal.ToString("c"));
                        payScreenScript.outputTotalText.text = outputTotalText.ToString();



                        currentOffer = currentOffer + moneyValue;
                        selfCheckoutMainText.Clear();
                        selfCheckoutMainText.Append($"{currencyType} {moneyValue.ToString("c")} {"Current Offer:" + currentOffer.ToString("c")} \n");
                        payScreenScript.mainText.text = selfCheckoutMainText.ToString();

                        PlayerMoneyHandler.PlayerMoney = PlayerMoneyHandler.PlayerMoney - moneyValue;



                        StartCoroutine("DestroyMoney");
                        scannable = false;
                        scanTimer = 0;
                    }
                    if (Convert.ToDecimal(currentOffer) >= payScreenScript.originalTotal && scanner.GetComponent <ScannerColliderScriptVRV2>().numItemsScanned > 0)
                    {
                        costReached  = true;
                        changeAmount = Convert.ToDecimal(moneyValue) - total;
                        payScreenScript.outputTotalText.text = $"{0:c}";
                        payScreenScript.changeText.text      = "CHANGE: " + $"{changeAmount:c}";

                        var expectedChange = changeCalculator.MakeChange(changeAmount);


                        foreach (var amt in expectedChange)
                        {
                            switch (amt)
                            {
                            case 50:
                                Instantiate(fiftyDollar, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            case 20:
                                Instantiate(twentyDollar, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            case 10:
                                Instantiate(tenDollar, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            case 5:
                                Instantiate(fiveDollar, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            case 1:
                                Instantiate(oneDollar, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            case .25m:
                                Instantiate(quarter, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            case .10m:
                                Instantiate(dime, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            case .05m:
                                Instantiate(nickel, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            case .01m:
                                Instantiate(penny, changeSpawner.transform.position, Quaternion.identity);
                                break;

                            default:
                                break;
                            }
                        }
                        StartCoroutine("PaymentReceived");
                    }
                }
            }
        }
    }
예제 #15
0
    public void TakeOver(bool result, State _state)
    {
        if (!result)
        {
            // turnover 넘기기
            //ni.GetSocket().Emit("turnOver");
            NetworkClient.CallTurnOver(ni);
        }
        else
        {
            MoneyData moneyData = new MoneyData();
            LandData  landData  = new LandData();
            soundManager.GetComponent <SoundManager>().playCashRegister();
            switch (_state)
            {
            case State.BuyLand:
                Debug.Log("TakeOver - BuyLand");
                moneyData.cost       = currentLand.price.land;
                moneyData.senderID   = NetworkClient.ClientID;
                moneyData.receiverID = "";
                landData.state       = "BuyLand";
                landData.landIndex   = landIndex;
                landData.id          = NetworkClient.ClientID;
                ni.GetSocket().Emit("updateBalance", new JSONObject(JsonUtility.ToJson(moneyData)));
                ni.GetSocket().Emit("updateLandData", new JSONObject(JsonUtility.ToJson(landData)));
                //ni.GetSocket().Emit("turnOver");
                NetworkClient.CallTurnOver(ni);
                break;

            case State.Building:
                Debug.Log("TakeOver - Building");
                landData.landIndex = landIndex;
                landData.state     = "Building";
                moneyData.senderID = currentLand.ownerID;
                moneyData.cost     = currentLand.price.building;
                ni.GetSocket().Emit("updateLandData", new JSONObject(JsonUtility.ToJson(landData)));
                ni.GetSocket().Emit("updateBalance", new JSONObject(JsonUtility.ToJson(moneyData)));
                //ni.GetSocket().Emit("turnOver");
                NetworkClient.CallTurnOver(ni);
                break;

            case State.Contract:
                Debug.Log("TakeOver - Contract");
                landData.landIndex = landIndex;
                landData.state     = "Contract";
                moneyData.senderID = currentLand.ownerID;
                moneyData.cost     = currentLand.price.contract;
                ni.GetSocket().Emit("updateLandData", new JSONObject(JsonUtility.ToJson(landData)));
                ni.GetSocket().Emit("updateBalance", new JSONObject(JsonUtility.ToJson(moneyData)));
                //ni.GetSocket().Emit("turnOver");
                NetworkClient.CallTurnOver(ni);
                break;

            case State.Acquire:
                Debug.Log("TakeOver - Acquire");
                moneyData.cost       = currentLand.totalValue * 2;
                moneyData.senderID   = NetworkClient.ClientID;
                moneyData.receiverID = currentLand.ownerID;
                landData.state       = "Acquire";
                landData.landIndex   = landIndex;
                landData.id          = NetworkClient.ClientID;
                ni.GetSocket().Emit("updateBalance", new JSONObject(JsonUtility.ToJson(moneyData)));
                ni.GetSocket().Emit("updateLandData", new JSONObject(JsonUtility.ToJson(landData)));
                //ni.GetSocket().Emit("turnOver");
                NetworkClient.CallTurnOver(ni);
                break;

            case State.Sell:
                Debug.Log("TakeOver - sell");
                landIndex = clickedLand;
                LandManager.lands[landIndex].land.GetComponent <Outline>().OnDisable();

                moneyData.cost       = currentLand.totalValue;
                moneyData.receiverID = NetworkClient.ClientID;
                landData.state       = "Sell";
                landData.landIndex   = landIndex;
                landData.id          = "";
                ni.GetSocket().Emit("updateBalance", new JSONObject(JsonUtility.ToJson(moneyData)));
                ni.GetSocket().Emit("updateLandData", new JSONObject(JsonUtility.ToJson(landData)));
                break;
            }
        }
    }
예제 #16
0
    void Update()
    {
        if (Camera.main == true)
        {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        }

        if (Physics.Raycast(ray, out hit, 10.0f) && Input.GetMouseButtonDown(0))
        {
            if (!IsPointerOverUIObject(Input.mousePosition))
            {
                if (hit.collider.tag == "Land" && NetworkClient.serverObjects[NetworkClient.ClientID].IsMyTurn())
                {
                    string str = hit.collider.gameObject.name;
                    str         = str.Substring(8);
                    clickedLand = int.Parse(str) - 1;
                    if (state == State.Sell) // 매각 상태일 때만 buildingUI 띄움
                    {
                        buildingUI_Text_Content.text  = "부족한 금액 : " + sellUI_Text.text;
                        buildingUI_Text_Content.text += "\n선택한 땅 매각 시 얻는 돈  : " + LandManager.lands[clickedLand].totalValue;

                        int remainingAmount = fee - (ni.GetPlayerManager().getBalance() + LandManager.lands[clickedLand].totalValue) > 0 ? fee - (ni.GetPlayerManager().getBalance() + LandManager.lands[clickedLand].totalValue) : 0;
                        buildingUI_Text_Content.text += "\n선택한 땅 매각 이후 충당해야할 금액  : " + remainingAmount;
                        buildingUI.SetActive(true);
                    }
                    // 게임중 Land 클릭 시 상세 정보 보여주기?
                }
            }
        }

        // buildingUI timer -> 토지 구입, 빌딩 건설, 계약 체결, 매매 등
        if (timer)
        {
            if (_time < waitTime)
            {
                _time += Time.deltaTime;
                buildingUI_LinearTimer.fillAmount = (waitTime - _time) / waitTime;
                if (buildingUI.GetComponent <ButtonControler>().clicked)
                {
                    userInput = buildingUI.GetComponent <ButtonControler>().result;
                }
            }
            else
            {
                buildingUI.GetComponent <ButtonControler>().clicked = true;
            }
        }

        // 매각 타이머
        if (sellTimer)
        {
            if (_sellTime < sellWaitTime)
            {
                _sellTime += Time.deltaTime;
                sellTimerUI_LinearTimer.fillAmount = (sellWaitTime - _sellTime) / sellWaitTime;
                if (buildingUI.GetComponent <ButtonControler>().clicked)
                {
                    userInput = buildingUI.GetComponent <ButtonControler>().result;
                }
                sellUI_Text.text = fee - ni.GetPlayerManager().getBalance() > 0 ? (fee - ni.GetPlayerManager().getBalance()).ToString() : 0.ToString();
            }
            else
            {
                // 매각 타임 종료
                for (int i = 0; i < LandManager.lands.Length; i++)
                {
                    if (LandManager.lands[i].ownerID == NetworkClient.ClientID)
                    {
                        LandManager.lands[i].land.GetComponent <Outline>().OnDisable();
                    }
                }
                sellTimerUI.SetActive(false);
                sellUI.SetActive(false);

                _sellTime = 0;
                userInput = false;
                sellTimer = false;
                buildingUI.GetComponent <ButtonControler>().clicked = false;
                buildingUI.GetComponent <ButtonControler>().result  = false;

                buildingUI.SetActive(false);

                if (ni.GetPlayerManager().getBalance() < TollFeeData_AfterSell.cost) //매각 타임이 끝났는데도 통행료 낼 돈을 마련하지 못함 -> 파산
                {
                    Debug.Log("after sell - bankrupt");
                    BankruptData bankrupt = new BankruptData();
                    bankrupt.id = NetworkClient.ClientID;
                    ni.GetSocket().Emit("GoBankrupt", new JSONObject(JsonUtility.ToJson(bankrupt)));
                }
                else
                {
                    Debug.Log("after sell - pay toll fee");
                    MoneyData moneyData = TollFeeData_AfterSell;
                    ni.GetSocket().Emit("updateBalance", new JSONObject(JsonUtility.ToJson(moneyData)));
                    //ni.GetSocket().Emit("turnOver");
                    NetworkClient.CallTurnOver(ni);
                }
            }
        }

        // 공지 타이머 -> 아무것도 할 수 없다는 것 공지
        if (noticeTimer)
        {
            if (_noticeTime < noticeWaitTime)
            {
                _noticeTime += Time.deltaTime;
                buildingUI_LinearTimer.fillAmount = (noticeWaitTime - _noticeTime) / noticeWaitTime;
            }
            else
            {
                noticeTimer = false;
                _noticeTime = 0;

                buildingUI.GetComponent <ButtonControler>().YesButton.gameObject.SetActive(true);
                buildingUI.GetComponent <ButtonControler>().NoButton.gameObject.SetActive(true);

                buildingUI.SetActive(false);

                //ni.GetSocket().Emit("turnOver");
                NetworkClient.CallTurnOver(ni);
            }
        }


        if (buildingUI.GetComponent <ButtonControler>().clicked)
        {
            // 처리 함수 call
            if (state == State.Sell && buildingUI.GetComponent <ButtonControler>().result == false)
            {
                buildingUI.GetComponent <ButtonControler>().clicked = false;
                buildingUI.GetComponent <ButtonControler>().result  = false;
                buildingUI.SetActive(false);
            }
            else
            {
                TakeOver(buildingUI.GetComponent <ButtonControler>().result, state);
                _time     = 0;
                userInput = false;
                timer     = false;
                buildingUI.GetComponent <ButtonControler>().clicked = false;
                buildingUI.GetComponent <ButtonControler>().result  = false;
                buildingUI.SetActive(false);
            }
        }

        if (moveCharacter)
        {
            float step = 1.5f * Time.deltaTime;
            ni.transform.position = Vector3.MoveTowards(ni.transform.position, arrivalPoint, step);

            if (Vector3.Distance(ni.transform.position, prevPoint) >= movingDistance)
            {
                movingDistance         += 1;
                diceUI_Dist_Result.text = (Int32.Parse(diceUI_Dist_Result.text) - 1).ToString();

                soundManager.GetComponent <SoundManager>().playWalk();
            }

            if (Vector3.Distance(ni.transform.position, arrivalPoint) == 0)
            {
                if (dist == 0)
                {
                    diceUI.SetActive(false);
                }

                if (dist == 0 && ni.IsMyTurn())
                {
                    this.CallTakeOver(arrivalPoint.x, arrivalPoint.z);
                }
                else if (dist != 0)
                {
                    Debug.Log("call make arrow");
                    arrowManager.GetComponent <ArrowManager>().MakeArrow(ni, mapSize, arrivalPoint.x, arrivalPoint.z);
                }
                else
                {
                    Debug.Log("dist == 0 && not my turn - nothing happened");
                }
                ni.GetPlayerManager().getAnimator().SetBool("isWalking", false);
                moveCharacter = false;
            }
        }
    }
예제 #17
0
        public ActionResult ReportMoney()
        {
            var viewModel = MoneyData.GetFakeData().ToList();

            return(View(viewModel));
        }