예제 #1
0
    void    OnGUI()
    {
        // 배경 이미지.

        if (GlobalParam.getInstance().fadein_start)
        {
            float title_alpha = Mathf.InverseLerp(1.0f, 0.0f, this.scene_timer);

            if (title_alpha > 0.0f)
            {
                GUI.color = new Color(1.0f, 1.0f, 1.0f, title_alpha);
                GUI.DrawTexture(new Rect(0.0f, 0.0f, Screen.width, Screen.height), this.title_image, ScaleMode.ScaleToFit, true);
            }
        }

        if (GlobalParam.get().is_disconnected)
        {
            GUI.Button(new Rect(Screen.width - 220.0f, Screen.height - 50.0f, 200.0f, 30.0f),
                       "친구와 연결이 끊어졌습니다");
        }
        else if (GlobalParam.get().is_connected)
        {
            if (this.disp_timer > 0.0f)
            {
                string message = (GlobalParam.get().account_name == "Toufuya")? "친구가 놀러왔습니다" :
                                 "친구와 놀 수 있습니다";
                // 대기 중인 플레이어에 게스트가 왔음을 알립니다.
                GUI.Button(new Rect(Screen.width - 280.0f, Screen.height - 50.0f, 250.0f, 30.0f), message);
            }
        }
    }
예제 #2
0
    public void OnGrid(Vector3 newPos)
    {
        // 宝石を拾う.
        m_map.PickUpItem(newPos);
        Vector3 direction;

        if (GlobalParam.GetInstance().IsAdvertiseMode())
        {
            direction = GetAdvModeMoveDirection();
        }
        else
        {
            direction = GetMoveDirection();
        }

        // キー入力なし(方向転換しない).
        if (direction == Vector3.zero)
        {
            return;
        }

        // キー入力の方向へ移動(移動できる場合).
        if (!m_grid_move.CheckWall(direction))
        {
            m_grid_move.SetDirection(direction);
        }
    }
예제 #3
0
    public void OnGrid(Vector3 newPos)
    {
        // 보석을 줍는다.
        m_map.PickUpItem(newPos);
        Vector3 direction;

        if (GlobalParam.GetInstance().IsAdvertiseMode())
        {
            direction = GetAdvModeMoveDirection();
        }
        else
        {
            direction = GetMoveDirection();
        }

        // 키 입력 없음(방향 전환 하지 않는다).
        if (direction == Vector3.zero)
        {
            return;
        }

        // 키 입력 방향으로 이동(이동할 수 있는 경우).
        if (!m_grid_move.CheckWall(direction))
        {
            m_grid_move.SetDirection(direction);
        }
    }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string merchantId = GlobalParam.getInstance().merchantId;

            label1.Text       = merchantId;
            merchantId1.Value = merchantId;
        }
예제 #5
0
    // ================================================================ //

    private void SendGameSyncInfo()
    {
        Debug.Log("[CLIENT]SendGameSyncInfo");

        SyncGameData data = new SyncGameData();

        data.version = GameServer.SERVER_VERSION;
        data.itemNum = 0;

        // 호스트에서는 이사 정보만 보냅니다.
        data.moving = new MovingData();
        if (GlobalParam.get().local_moving.moving)
        {
            data.moving = GlobalParam.get().local_moving;
        }
        else
        {
            data.moving.characterId = "";
            data.moving.houseId     = "";
            data.moving.moving      = false;
        }

        SyncGamePacketHouse packet = new SyncGamePacketHouse(data);

        if (m_network != null)
        {
            m_network.SendReliable <SyncGameData>(packet);
        }
    }
예제 #6
0
    public void OnGrid(Vector3 newPos)
    {
        // 捡起宝石
        m_map.PickUpItem(newPos);
        Vector3 direction;

        if (GlobalParam.GetInstance().IsAdvertiseMode())
        {
            direction = GetAdvModeMoveDirection();
        }
        else
        {
            direction = GetMoveDirection();
        }

        // 没有按键输入(不转换方向)
        if (direction == Vector3.zero)
        {
            return;
        }

        // 先按键输入的方向移动(允许移动的情况下)
        if (!m_grid_move.CheckWall(direction))
        {
            m_grid_move.SetDirection(direction);
        }
    }
예제 #7
0
    //===================================================

    void Awake()
    {
        GameObject netobj = GameObject.Find("Network");

        if (netobj != null)
        {
            network = netobj.GetComponent <Network>();
        }

        // 로컬 플레이어 생성
        createLocalPlayer(GlobalParam.get().global_account_id);
        Debug.Log("global_account_id" + GlobalParam.get().global_account_id);

        for (int i = 0; i < GlobalParam.get().playerNum; i++)
        {
            // 로컬 플레이어는 스킵
            if (i == GlobalParam.get().global_account_id)
            {
                continue;
            }

            // 연결된 모든 네트워크 플레이어 생성
            if (network != null)
            {
                createNetPlayer(i);

                // 생성된 네트워크 플레이어에 인덱스 부여
                // 이 인덱스는 노드의 키 값과 같다
                GetNetPlayerObject(i).GetComponent <NetPlayerCtrl>().globalId = i;
            }
        }
    }
예제 #8
0
    // ---------------------------------------------------------------- //
    // 통신 처리 함수.

    //
    public void OnReceiveSyncGamePacket(PacketId id, byte[] data)
    {
        Debug.Log("Receive GameSyncPacket.[TitleControl]");

        SyncGamePacket packet = new SyncGamePacket(data);
        SyncGameData   sync   = packet.GetPacket();

        for (int i = 0; i < sync.itemNum; ++i)
        {
            string log = "[CLIENT] Sync item pickedup " +
                         "itemId:" + sync.items[i].itemId +
                         " state:" + sync.items[i].state +
                         " ownerId:" + sync.items[i].ownerId;
            Debug.Log(log);

            ItemManager.ItemState istate = new ItemManager.ItemState();

            // 아이템의 상태를 매니저에 등록.
            istate.item_id = sync.items[i].itemId;
            istate.state   = (ItemController.State)sync.items[i].state;
            istate.owner   = sync.items[i].ownerId;

            if (GlobalParam.get().item_table.ContainsKey(istate.item_id))
            {
                GlobalParam.get().item_table.Remove(istate.item_id);
            }
            GlobalParam.get().item_table.Add(istate.item_id, istate);
        }

        isReceiveSyncGameData = true;
    }
예제 #9
0
    void    Update()
    {
        if (this.pressed_button != "")
        {
            switch (this.pressed_button)
            {
            case "easy":
            {
                GlobalParam.GetInstance().SetMode(0);
                UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene");
            }
            break;

            case "normal":
            {
                GlobalParam.GetInstance().SetMode(1);
                UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene");
            }
            break;

            case "hard":
            {
                GlobalParam.GetInstance().SetMode(2);
                UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene");
            }
            break;

            default:
                break;
            }
        }
    }
예제 #10
0
    // 오류 GUI
    private void NotifyError()
    {
        GUIStyle style = new GUIStyle(GUI.skin.GetStyle("button"));

        style.normal.textColor = Color.white;
        style.fontSize         = 20;

        float sx = 400;
        float sy = 150;
        float px = Screen.width / 2 - sx * 0.5f;
        float py = Screen.height / 2 - sy * 0.5f;

        string message = "통신 오류가 발생했습니다.\n게임을 종료합니다.";

        if (GUI.Button(new Rect(px, py, sx, sy), message, style))
        {
            // 네트워크 연결을 끊고
            if (GlobalParam.get().is_host)
            {
                network.StopGameServer();
            }
            network.StopServer();
            network.Disconnect();

            hostDisconnected = false;

            GameObject.Destroy(network);

            // 타이틀 씬으로 되돌아간다
            Application.LoadLevel("UILobby");
        }
    }
예제 #11
0
파일: GameRoot.cs 프로젝트: wyuurla/006772
    // 오류 알림.
    private void NotifyError()
    {
        GUIStyle style = new GUIStyle(GUI.skin.GetStyle("button"));

        style.normal.textColor = Color.white;
        style.fontSize         = 25;

        float sx = 450;
        float sy = 200;
        float px = Screen.width / 2 - sx * 0.5f;
        float py = Screen.height / 2 - sy * 0.5f;

        string message = "통신 오류가 발생했습니다.\n게임을 종료합니다.\n\n버튼을 누르세요.";

        if (GUI.Button(new Rect(px, py, sx, sy), message, style))
        {
            this.step.set_next(STEP.NONE);
            if (GlobalParam.get().is_host)
            {
                network.StopGameServer();
            }
            network.StopServer();
            network.Disconnect();

            GameObject.Destroy(network);

            Application.LoadLevel("TitleScene");
        }
    }
예제 #12
0
    public void OnReceiveUseItemPacket(int node, PacketId id, byte[] data)
    {
        ItemUsePacket packet  = new ItemUsePacket(data);
        ItemUseData   useData = packet.GetPacket();

        Debug.Log("Receive UseItemPacket:" + useData.userId + " -> " +
                  useData.targetId + " (" + useData.itemCategory + ")");

        chrController user = CharacterRoot.getInstance().findPlayer(useData.userId);

        AccountData account_data = AccountManager.get().getAccountData(GlobalParam.getInstance().global_account_id);

        if (user != null && account_data.avator_id != useData.userId)
        {
            Debug.Log("use item. favor:" + useData.itemFavor);

            Item.Favor favor = new Item.Favor();
            favor.category = (Item.CATEGORY)useData.itemCategory;
            this.useItem(-1, favor, useData.userId, useData.targetId, false);
        }
        else
        {
            Debug.Log("Receive packet is already done.");
        }
    }
예제 #13
0
    void OnReceiveStartSession(int node, PacketId id, byte[] data)
    {
        Debug.Log("ReceiveStartSession");

#if UNUSE_MATCHING_SERVER
        SessionData response = new SessionData();

        {
            int         memberNum = NetConfig.PLAYER_MAX;
            string      hostname  = Dns.GetHostName();
            IPAddress[] adrList   = Dns.GetHostAddresses(hostname);
            response.endPoints = new EndPointData[memberNum];

            response.result   = MatchingResult.Success;
            response.playerId = GlobalParam.get().global_account_id;
            response.members  = memberNum;

            for (int i = 0; i < memberNum; ++i)
            {
                response.endPoints[i]           = new EndPointData();
                response.endPoints[i].ipAddress = adrList[0].ToString();
                response.endPoints[i].port      = NetConfig.GAME_PORT;
            }
        }
#else
        SessionPacket packet   = new SessionPacket(data);
        SessionData   response = packet.GetPacket();
#endif
        playerId = response.playerId;

        SetSessionMembers(response.result, response.members, response.endPoints);

        matchingState = State.MatchingEnded;
    }
예제 #14
0
    // ---------------------------------------------------------------- //
    // 패킷 수신 함수].

    // 동기 대기 패킷 수신.
    public void OnReceiveSyncPacket(int node, PacketId id, byte[] data)
    {
        Debug.Log("[CLIENT]OnReceiveSyncPacket");

        GameSyncPacket packet = new GameSyncPacket(data);
        GameSyncInfo   sync   = packet.GetPacket();

        GlobalParam.get().seed = sync.seed;

        // 초기 장비를 보존한다.
        for (int i = 0; i < sync.items.Length; ++i)
        {
            CharEquipment equip = sync.items[i];

            GlobalParam.get().shot_type[equip.globalId] = (SHOT_TYPE)equip.shotType;
            this.select_done_players[equip.globalId] = true;

            Debug.Log("[CLIENT] AccountID:" + equip.globalId + " ShotType:" + equip.shotType);
        }

        // 응답이 있는 쿼리를 검색.
        string            account_id = this.player.control.getAccountID();
        QuerySelectFinish query      = QueryManager.get().findQuery <QuerySelectFinish>(x => x.account_id == account_id);

        if (query != null)
        {
            Debug.Log("[CLIENT]QuerySelectDone done");
            query.set_done(true);
            query.set_success(true);
        }

        Debug.Log("[CLIENT]Recv seed:" + sync.seed);
    }
예제 #15
0
 void    Update()
 {
     if (GlobalParam.GetInstance().IsAdvertiseMode() && Input.GetMouseButtonDown(0))
     {
         UnityEngine.SceneManagement.SceneManager.LoadScene("TitleScene");
     }
 }
예제 #16
0
    void    Start()
    {
        switch (GlobalParam.GetInstance().difficulty())
        {
        case 0:
        {
            this.level = LEVEL.EASY;
        }
        break;

        case 1:
        {
            this.level = LEVEL.NORMAL;
        }
        break;

        case 2:
        {
            this.level = LEVEL.HARD;
        }
        break;

        default:
        {
            this.level = LEVEL.EASY;
        }
        break;
        }
    }
예제 #17
0
 public void             OnPlayButtonPressed()
 {
     m_PlayButtonPushed = true;
     GetComponent <AudioSource>().Play();
     GlobalParam.GetInstance().SetMode(false);
     StartCoroutine(StartGame());
 }
예제 #18
0
    protected Seed  create_seed(string id)
    {
        string local_account = AccountManager.get().getAccountData(GlobalParam.get().global_account_id).account_id;

        Seed seed = null;

        seed = this.seeds.Find(x => x.id == id);

        if (seed == null)
        {
            // 찾지 못했으므로 만든다.
            seed = new Seed(local_account, id);

            this.seeds.Add(seed);

            // [TODO] seeds가 전 단말에서 공통되게 동기화한다.
        }
        else
        {
            if (seed.creator == local_account)
            {
                // 같은 id의 시드를 두 번이상 만들려고 함.
                Debug.LogError("Seed \"" + id + "\" already exist.");
                seed = null;
            }
            else
            {
                // 다른 플레이어가 만든 같은 시드가 있었다.
            }
        }

        return(seed);
    }
예제 #19
0
    // 네트 플레이어 만들기.
    public void             createNetPlayer(int account_global_index)
    {
        chrBehaviorLocal local_player = this.players[0].GetComponent <chrBehaviorLocal>();

        chrBehaviorNet net_player = null;

        int local_index = this.players.Count;

        AccountData account_data = AccountManager.get().getAccountData(account_global_index);

        string avator_name = "Player_" + account_data.avator_id;

        net_player = CharacterRoot.getInstance().createPlayerAsNet(avator_name).GetComponent <chrBehaviorNet>();

        net_player.control.local_index  = local_index;
        net_player.control.global_index = account_global_index;
        net_player.local_player         = local_player;

        net_player.position_in_formation = this.getInFormationOffset(account_global_index);

        SHOT_TYPE shot_type = GlobalParam.get().shot_type[account_global_index];

        net_player.changeBulletShooter(shot_type);

        net_player.transform.Translate(this.getLocalPlayer().control.getPosition() + net_player.position_in_formation);

        this.players.Add(net_player);
    }
예제 #20
0
파일: GameRoot.cs 프로젝트: wyuurla/006772
    // 네트워크 플레이어와 통신이 연결되었는가?.
    public bool             isConnected(int global_account_index)
    {
        bool ret = false;

        if (this.network != null)
        {
            int node = this.network.GetClientNode(global_account_index);

            ret = this.network.IsConnected(node);
        }
        else
        {
            // 디버그용.
            if (global_account_index == GlobalParam.get().global_account_id)
            {
                ret = true;
            }
            else
            {
                ret = GlobalParam.get().db_is_connected[global_account_index];
            }
        }

        return(ret);
    }
예제 #21
0
    // ================================================================ //
    // MonoBehaviour에서 상속.

    void    Start()
    {
        this.step      = STEP.NONE;
        this.next_step = STEP.WAIT;

        GlobalParam.getInstance().fadein_start = true;

        if (!TitleControl.is_single)
        {
        #if true
            this.m_serverAddress = "";

            // 호스트 이름을 얻는다.
            string hostname = Dns.GetHostName();

            // 호스트 이름에서 IP주소를 얻는다.
            IPAddress[] adrList = Dns.GetHostAddresses(hostname);
            m_serverAddress = adrList[0].ToString();
        #endif
            GameObject obj = GameObject.Find("Network");
            if (obj == null)
            {
                obj = new GameObject("Network");
            }

            if (m_network == null)
            {
                m_network = obj.AddComponent <Network>();
                if (m_network != null)
                {
                    DontDestroyOnLoad(m_network);
                }
            }
        }
    }
예제 #22
0
        /// <summary>
        /// основной конструктор
        /// </summary>
        /// <param name="number_Window">номер бота (номер окна)</param>
        public botWindow(int number_Window)
        {
            numberWindow = number_Window;     // эта инфа поступает при создании объекта класса
            botParam     = new BotParam(numberWindow);
            globalParam  = new GlobalParam();

            this.xx      = botParam.X;
            this.yy      = botParam.Y;
            this.hwnd    = botParam.Hwnd;
            this.channel = botParam.Kanal;

            #region Вариант 1. переменные класса подчитываются из текстовых файлов

            //this.databot = LoadUserDataBot(TypeLoadUserData.txt);

            #endregion

            #region Вариант 2. переменные класса подчитываются из БД

            //this.databot = LoadUserDataBot(TypeLoadUserData.db);

            #endregion

            //this.statusOfAtk = GetStatusOfAtk();              //значение статуса, 1 - мы уже били босса, 0 - нет

//            serverFactory = new ServerFactory(number_Window);
            serverFactory = new ServerFactory(this);
            server        = serverFactory.create(); // создали конкретный экземпляр класса server по паттерну "простая Фабрика" (Америка, Европа или Синг)


            // точки для тыканья. универсально для всех серверов
            this.pointButtonClose = new Point(850 - 5 + xx, 625 - 5 + yy); //(848, 620);
            this.pointOneMode     = new Point(123 - 5 + xx, 489 - 5 + yy); // 118, 484
        }
예제 #23
0
    // 포메이션 이동 중(주로 FakeNet) 위치 오프셋.
    public Vector3  getInFormationOffset(int account_global_index)
    {
        Vector3 offset = this.getPositionOffset(account_global_index);

        Vector3 local_player_offset = this.getPositionOffset(GlobalParam.getInstance().global_account_id);

        return(offset - local_player_offset);
    }
예제 #24
0
 private void Awake()
 {
     globalParametrs = mainPanel.GetComponent <GlobalParam>();
     if (!PlayerPrefs.HasKey("marketing"))
     {
         PlayerPrefs.SetString("marketing", "0");
     }
 }
예제 #25
0
 public MouseEvens(IntPtr m_Handle)
 {
     this.m_Handle       = m_Handle;
     this.mouseStatus    = MouseStatus.GetMouseStatus();
     this.globalParam    = GlobalParam.GetGlobalParam();
     this.jichuViewModel = JichuViewModel.GetJichuViewModel();
     this.player         = Player.GetPlay();
 }
예제 #26
0
 // Update is called once per frame
 void Update()
 {
     m_go_adv -= Time.deltaTime;
     if (m_go_adv < 0.0f && !m_PlayButtonPushed)
     {
         GlobalParam.GetInstance().SetMode(true);
         UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene");
     }
 }
예제 #27
0
 public StateGT129(botWindow botwindow)
 {
     this.botwindow     = botwindow;
     this.serverFactory = new ServerFactory(botwindow);
     this.server        = serverFactory.create(); // создали конкретный экземпляр класса server по паттерну "простая Фабрика" (Америка, Европа или Синг)
     globalParam        = new GlobalParam();
     botParam           = new BotParam(botwindow.getNumberWindow());
     this.tekStateInt   = 129;
 }
예제 #28
0
    // ================================================================ //
    // MonoBehaviour에서의 상속.

    void    Start()
    {
        this.score_disp = GameObject.FindGameObjectWithTag("Score Disp").GetComponent <ScoreDisp>();
        this.high_score = GlobalParam.getInstance().getHighScore();
        this.last_socre = GlobalParam.getInstance().getLastScore();
        this.next_step  = STEP.RESULT;

        this.sound_control = GameObject.Find("SoundRoot").GetComponent <SoundControl>();
    }
예제 #29
0
 public StateGT250(botWindow botwindow)   //, GotoTrade gototrade)
 {
     this.botwindow     = botwindow;
     this.serverFactory = new ServerFactory(botwindow);
     this.server        = serverFactory.create(); // создали конкретный экземпляр класса server по паттерну "простая Фабрика" (Америка, Европа или Синг)
     this.town          = server.getTown();
     globalParam        = new GlobalParam();
     botParam           = new BotParam(botwindow.getNumberWindow());
     this.tekStateInt   = 250;
 }
예제 #30
0
    private Score last_socre; // 今回のスコアー.

    #endregion Fields

    #region Methods

    public static GlobalParam getInstance()
    {
        if(instance == null) {
            GameObject	go = new GameObject("GlobalParam");
            instance = go.AddComponent<GlobalParam>();
            instance.initialize();
            DontDestroyOnLoad(go);
        }
        return(instance);
    }
예제 #31
0
 // GlobalParamは一度だけ作成してインスタンスを返す.
 // (作成後は作成済みのインスタンスを返す).
 public static GlobalParam GetInstance()
 {
     if (instance == null)
     {
         GameObject globalParam = new GameObject("GlobalParam");
         instance = globalParam.AddComponent <GlobalParam>();
         DontDestroyOnLoad(globalParam);
     }
     return(instance);
 }
예제 #32
0
    // ================================================================ //
    void Awake()
    {
        if (instance == null)
        {
            GameObject go = GameObject.Find("GlobalParam");

            instance = go.GetComponent<GlobalParam>();
            instance.create();

            DontDestroyOnLoad(go);
        }
    }