Esempio n. 1
0
    private void Awake()
    {
        avatars = new MonoBehaviourPooler<World.Avatar, AvatarView>(avatarPrefab,
                                                                    avatarContainer,
                                                                    InitialiseAvatar);

        tiles = new SpriteRenderer[1024];
        walls = new SpriteRenderer[1024];

        for (int i = 0; i < 1024; ++i)
        {
            int x = i % 32;
            int y = i / 32;

            SpriteRenderer tile = Instantiate(tilePrefab);

            tile.transform.SetParent(tileContainer, false);
            tile.transform.localPosition = new Vector2(x * 32 - 512, y * 32 - 512);
            tile.gameObject.SetActive(true);

            tiles[i] = tile;

            SpriteRenderer wall = Instantiate(wallPrefab);
            wall.transform.SetParent(wallContainer, false);
            wall.transform.localPosition = new Vector2(x * 32 - 512, y * 32 - 512);

            walls[i] = wall;
        }
    }
Esempio n. 2
0
    private void Awake()
    {
        test_cells = new MonoBehaviourPooler <Cell, SpriteRenderer>(cellPrefab,
                                                                    cellParent,
                                                                    InitTestCell);

        fleetCounts = new MonoBehaviourPooler <Fleet, FleetCountPanel>(fleetCountPrefab,
                                                                       fleetCountParent,
                                                                       (f, p) => p.SetFleet(f));
    }
Esempio n. 3
0
    private void Awake()
    {
        hostButton.onClick.AddListener(OnClickedHost);

        worlds = new MonoBehaviourPooler<World.Info, SavedWorldPanel>(worldPrefab,
                                                                      worldParent,
                                                                      InitialiseWorld);

        generateToggle.onValueChanged.AddListener(active =>
        {
            if (active) selectedWorld = null;
        });
    }
Esempio n. 4
0
    private void Awake()
    {
        lockButton.onClick.AddListener(OnClickedLock);

        tiles = new MonoBehaviourPooler<byte, TileToggle>(tilePrefab,
                                                          tileContainer,
                                                          InitialiseTile);

        pages = new MonoBehaviourPooler<int, Toggle>(pagePrefab,
                                                     pageContainer,
                                                     InitialisePage);

        pages.SetActive(Enumerable.Range(0, 8));
        pages.Get(0).isOn = true;
    }
Esempio n. 5
0
 private void Awake()
 {
     log = new MonoBehaviourPooler<Test.LoggedMessage, ChatLogElement>(logPrefab,
                                                                       logContainer,
                                                                       InitialiseLog);
 }
Esempio n. 6
0
    private void Awake()
    {
        foreach (Font font in fonts) font.material.mainTexture.filterMode = FilterMode.Point;

        tutorialObject.SetActive(false);

        match = gameObject.AddComponent<NetworkMatch>();
        match.baseUri = new System.Uri("https://eu1-mm.unet.unity3d.com");

        enterButton.onClick.AddListener(OnClickedEnter);

        worlds = new MonoBehaviourPooler<GameListing, WorldPanel>(worldPrefab,
                                                                  worldContainer,
                                                                  InitialiseWorld);

        Application.runInBackground = true;

        StartCoroutine(SendMessages());

        avatarGraphic = BlankTexture.New(32, 32, Color.clear);
        ResetAvatar();

        chatOverlay.Setup(chats,
                          message =>
                          {
                              tutorialChat.SetActive(false);

                              SendAll(ChatMessage(worldView.viewer, message));

                              Chat(worldView.viewer, message);
                          });

        customiseTab.Setup(tileEditor,
                           BlankTexture.FullSprite(avatarGraphic),
                           SaveConfig,
                           ResetAvatar);

        LoadConfig();

        mapTextureLocal = new Texture2D(1024, 1024);

        ipOpen.onClick.AddListener(() => { ipObject.SetActive(true); ipInput.text = ""; });
        ipAccept.onClick.AddListener(() => { PreConnect();  ConnectThroughLAN(ipInput.text); ipObject.SetActive(false); } );
        ipCancel.onClick.AddListener(() => ipObject.SetActive(false));
    }