Esempio n. 1
0
    private RoomData ConvertRoomToData(GameObject room)
    {
        RoomData roomData = new RoomData();
        var      position = room.transform.position;

        roomData.x = (int)position.x;
        roomData.y = (int)position.y;
        ObjectScript os = room.GetComponent <ObjectScript>();

        roomData.rotation    = os.rotAdjust;
        roomData.isPrePlaced = os.preplacedRoom;
        roomData.objectNum   = os.objectNum;
        RoomStats roomStats = room.GetComponent <RoomStats>();

        roomData.crew                  = roomStats.currentCrew;
        roomData.usedRoom              = roomStats.usedRoom;
        roomData.roomLevel             = roomStats.GetRoomLevel();
        roomData.resourceActiveAmounts = new int[roomStats.resources.Count];
        for (var i = 0; i < roomStats.resources.Count; i++)
        {
            roomData.resourceActiveAmounts[i] = roomStats.resources[i].activeAmount;
        }

        return(roomData);
    }
Esempio n. 2
0
 private void Start()
 {
     roomNameUI.text  = roomStats.roomName;
     roomDescUI.text  = roomStats.roomDescription;
     roomLevelUI.text = roomStats.GetRoomLevel().ToString();
 }
Esempio n. 3
0
    private void UpdatePanelInfo()
    {
        // enable UI elements
        foreach (GameObject roomDetailSection in roomDetailsInfo)
        {
            roomDetailSection.SetActive(true);
        }

        // set room details
        roomImage.sprite = selectedRoom.GetComponentInChildren <SpriteRenderer>().sprite;
        roomName.text    = roomStats.roomName;
        roomDesc.text    = roomStats.roomDescription;
        roomLevel.text   = "Level: " + roomStats.GetRoomLevel();
        roomSize.text    = selectedRoom.GetComponent <ObjectScript>().shapeDataTemplate.roomSizeName;
        usedImage.SetActive(roomStats.usedRoom);

        // set room requirements details
        needsCredits.text = roomStats.price[roomStats.GetRoomLevel() - 1].ToString();
        needsPower.text   = roomStats.minPower[roomStats.GetRoomLevel() - 1].ToString();
        needsCrew.text    = roomStats.minCrew + "-" + roomStats.maxCrew;

        // update room production, crew value, and crew buttons
        UpdateCrewAssignment();

        // set room overtime details
        SetOvertimeButtonState(GameManager.instance.currentGameState == InGameStates.Events && overclockRoom.MinigameCooledDown);
        overtimeIcon.gameObject.SetActive(true);
        switch (overclockRoom.GetMiniGame())
        {
        case MiniGameType.Security:
            overtimeResource.text = GameManager.instance.GetResourceData((int)ResourceDataTypes._Security).resourceName;
            overtimeIcon.sprite   = GameManager.instance.GetResourceData((int)ResourceDataTypes._Security).resourceIcon;
            break;

        case MiniGameType.Asteroids:
            overtimeResource.text = GameManager.instance.GetResourceData((int)ResourceDataTypes._ShipWeapons).resourceName;
            overtimeIcon.sprite   = GameManager.instance.GetResourceData((int)ResourceDataTypes._ShipWeapons).resourceIcon;
            break;

        case MiniGameType.CropHarvest:
            overtimeResource.text = GameManager.instance.GetResourceData((int)ResourceDataTypes._Food).resourceName;
            overtimeIcon.sprite   = GameManager.instance.GetResourceData((int)ResourceDataTypes._Food).resourceIcon;
            break;

        case MiniGameType.StabilizeEnergyLevels:
            overtimeResource.text = GameManager.instance.GetResourceData((int)ResourceDataTypes._Energy).resourceName;
            overtimeIcon.sprite   = GameManager.instance.GetResourceData((int)ResourceDataTypes._Energy).resourceIcon;
            break;

        case MiniGameType.SlotMachine:
            overtimeResource.text = GameManager.instance.GetResourceData((int)ResourceDataTypes._Credits).resourceName;
            overtimeIcon.sprite   = GameManager.instance.GetResourceData((int)ResourceDataTypes._Credits).resourceIcon;
            break;

        case MiniGameType.HullRepair:
            overtimeResource.text = GameManager.instance.GetResourceData((int)ResourceDataTypes._HullDurability).resourceName;
            overtimeIcon.sprite   = GameManager.instance.GetResourceData((int)ResourceDataTypes._HullDurability).resourceIcon;
            break;

        default:
            overtimeResource.text = "";
            overtimeIcon.gameObject.SetActive(false);
            SetOvertimeButtonState(false);     // disable button is no mini-game on room
            //overtimeToolTipDisabledText.SetActive(true);
            overtimeToolTipDisabledText.text = "No Overtime Mini-Game for this Room";
            break;
        }

        // see if chat available
        UpdateChatAvailability();
    }