예제 #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj">
 /// obj[0] =  TeamInfo
 /// obj[1] = AllUserAndTeam
 /// </param>
 private void teamUpdate_Click(object obj)
 {
     this.teamUpdate.IsEnabled = false;
     Mouse.OverrideCursor      = Cursors.Wait;
     try
     {
         if (obj is ArrayList)
         {
             this.ServiceConnectionChecker();
             ArrayList dataList    = obj as ArrayList;
             TeamInfo  newTeamInfo = dataList[0] as TeamInfo;
             newTeamInfo.TeamAdmin = counter.customerDetail.Username;
             if (ServerConnection.serviceFromServer.AddNewTeam(newTeamInfo, new List <AllUserAndTeam>(dataList[1] as ObservableCollection <AllUserAndTeam>)))
             {
                 Mouse.OverrideCursor = null;
                 DXMessageBox.Show(CVsVariables.ERROR_MESSAGES[0, 10], CVsVariables.SOTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Information);
             }
         }
     }
     catch (Exception error)
     {
         Mouse.OverrideCursor = null;
         DXMessageBox.Show(error.Message, CVsVariables.SOTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         this.teamUpdate.IsEnabled = true;
         Mouse.OverrideCursor      = null;
     }
 }
        public async void Test_Create_TeamInfo()
        {
            //Arrange
            var db = DbSource.CreateDbSource();
            var c  = new TeamInfoesController(db);

            var teamInfo = new TeamInfo
            {
                TeamInfoId   = 2,
                TeamName     = "Aurora",
                TeamLogoURL  = "",
                TeamDivision = "Under 18",
                HomeField    = "Stadium",
                TeamManager  = "Bob"
            };
            //Act
            var r = await c.Create(teamInfo);

            //Assert
            var result = Assert.IsType <RedirectToActionResult>(r);

            Assert.Equal("Index", result.ActionName);
            Assert.Equal(1, db.TeamInfo.Where(x => x.TeamName == teamInfo.TeamName && x.TeamDivision == teamInfo.TeamDivision && x.HomeField == teamInfo.HomeField &&
                                              x.TeamManager == teamInfo.TeamManager).Count());
        }
        private static void ApplyCEOLoyalty(GameEntity company, TeamInfo team, GameContext gameContext,
                                            ref Bonus <int> bonus, GameEntity worker, WorkerRole role)
        {
            bool hasCeo = HasMainManagerInTeam(company.team.Teams[0]);

            bonus.AppendAndHideIfZero("No CEO", hasCeo ? 0 : -4);

            var manager = GetMainManagerRole(team);
            var lead    = GetWorkerByRole(manager, team, gameContext);

            if (lead == null)
            {
                bonus.Append($"No {Humans.GetFormattedRole(manager)} in team", -4);
            }
            else
            {
                var CEORating    = Humans.GetRating(lead);
                var workerRating = Humans.GetRating(worker);

                if (CEORating < workerRating)
                {
                    bonus.Append($"Incompetent leader (leader rating less than {workerRating})", -1);
                }
            }
        }
예제 #4
0
    public void Init()
    {
        return;

        updateGaols        = true;
        timeCountDownSpeed = ((float)matchTimeMin / (float)totalTimeMin);
        timeTotal          = DateTime.UtcNow.AddMinutes(matchTimeMin);
        startTime          = DateTime.UtcNow;
        ball          = FindObjectOfType <Ball>();
        kickOff       = true;
        canChangeTurn = true;

        TeamInfo info1 = new TeamInfo();

        info1.formation     = Enums.FormationId.f_2;
        info1.PlayerName    = "Playes";
        info1.shootersCount = 5;
        info1.teamMat       = MainSceneManager.instance.materialFactory.GetMaterial(Enums.MaterialId.Chelsae).material;

        TeamInfo info2 = new TeamInfo();

        info2.formation     = Enums.FormationId.f_2;
        info2.PlayerName    = "Playes";
        info2.shootersCount = 5;
        info2.teamMat       = MainSceneManager.instance.materialFactory.GetMaterial(Enums.MaterialId.Manu).material;

        SetUpTeam(info1, info2);
        initialised = true;
    }
        public async void Test_Create_Invalid_TeamInfo_HomeField()
        {
            //Arrange
            var db = DbSource.CreateDbSource();
            var c  = new TeamInfoesController(db);

            var teamInfo = new TeamInfo
            {
                TeamName     = "Newmarket",
                TeamLogoURL  = "",
                TeamDivision = "Adult",
                TeamManager  = "Andrew"
            };

            c.ModelState.AddModelError("HomeField", "Required");

            //Act
            var r = await c.Create(teamInfo);

            //Assert
            var result = Assert.IsType <ViewResult>(r);
            var model  = Assert.IsAssignableFrom <TeamInfo>(result.ViewData.Model);

            Assert.Equal(teamInfo, model);
        }
예제 #6
0
    public void SetEntity(TeamInfo info, int teamId, TeamTask task = null)
    {
        this.teamId = teamId;

        var max = C.TASKS_PER_TEAM;

        var company = Flagship;

        var chosenSlots = company.team.Teams[teamId].Tasks.Count;

        freeSlots = max - chosenSlots;

        TeamInfo = info;
        TeamType = info.TeamType;

        TeamName.text = info.Name;

        ChooseHireManagersOfTeam.SetEntity(teamId);
        TeamTypeImage.sprite = GetTeamTypeSprite();

        if (task != null)
        {
            RenderTaskAssignTeamView(task, info);
        }
        else
        {
            RenderDefaultTeamView(chosenSlots, info);
        }
    }
예제 #7
0
        public static IEnumerable <WorkerRole> GetRolesForTeam(TeamInfo team)
        {
            var roles = GetRolesForTeam(team.TeamType).ToList();

            var mainRole = GetMainManagerRole(team);

            if (team.isCoreTeam)
            {
                // CEO only
                roles.Remove(WorkerRole.ProjectManager);
            }
            else
            {
                // regular universal team
                if (IsUniversalTeam(team.TeamType))
                {
                    roles.Remove(WorkerRole.CEO);
                }
            }

            /*if (team.Rank == TeamRank.Solo || team.Rank == TeamRank.SmallTeam)
             * {
             *  roles.RemoveAll(r => r != mainRole);
             * }*/

            return(roles);
        }
예제 #8
0
        public static void AddTeam(GameEntity company, GameContext gameContext, TeamType teamType)
        {
            if (!IsCanAddMoreTeams(company, gameContext))
            {
                return;
            }

            var team = new TeamInfo
            {
                TeamType = teamType,
                Tasks    = new List <TeamTask>(),

                Managers = new List <HumanFF>(),
                Roles    = new Dictionary <int, WorkerRole>(),

                ManagerTasks = new List <ManagerTask> {
                    ManagerTask.None, ManagerTask.None, ManagerTask.None
                },

                HiringProgress = 0,
                Workers        = 0,
                Organisation   = 0,
                ID             = company.team.Teams.Count,
                Rank           = TeamRank.Solo,

                isManagedBadly = false,

                TooManyLeaders = false
            };

            company.team.Teams.Add(team);

            team.Name = GenerateTeamName(company, team);
        }
예제 #9
0
파일: TeamModel.cs 프로젝트: Hengle/Fish
    public void UpdateTeamTarget(int target)
    {
        var temp = teamInfo;

        temp.target = target;
        teamInfo    = temp;
    }
예제 #10
0
    public IEnumerator UpdateTeam(TeamInfo team, Action <bool> callback = null)
    {
        var updateBody = JsonUtils.SerializeObject(team);
        var request    = BasicPut("/teams/" + team.ID, updateBody);

        yield return(request.SendWebRequest());

        var botUpdateFailed = false;

        if (!request.EncounteredError())
        {
            foreach (var bot in team.Bots)
            {
                yield return(runner.StartCoroutine(UpdateBot(bot, success =>
                {
                    if (!success)
                    {
                        botUpdateFailed = true;
                    }
                })));
            }
        }

        if (botUpdateFailed)
        {
            callback?.Invoke(false);
        }
        else
        {
            SimpleCallback(request, null, callback);
        }
    }
예제 #11
0
파일: TeamModel.cs 프로젝트: Hengle/Fish
    public void UpdateTeamLevelLimit(Int2 levelLimit)
    {
        var temp = teamInfo;

        temp.levelLimit = levelLimit;
        teamInfo        = temp;
    }
예제 #12
0
        /// <summary>
        /// 获取阵容信息
        /// </summary>
        public int Call_TeamList(TeamRequest request)
        {
            TeamResponse response = new TeamResponse();

            response.success = true;
            response.pid     = CurrentSession.UserId;
            response.teams5  = new List <TeamInfo>();
            response.teams10 = new List <TeamInfo>();

            var player = this.CurrentSession.GetBindPlayer();

            foreach (var team in player.Teams)
            {
                TeamInfo ti = new TeamInfo();
                ti.selected = team.IsSelected;
                ti.id       = team.Id;
                ti.bps      = team.Units.Object;
                response.teams5.Add(ti);
            }
            foreach (var f in player.Formations)
            {
                TeamInfo ti = new TeamInfo();
                ti.selected = f.IsSelected;
                ti.id       = f.Id;
                ti.bps      = f.Units.Object;
                response.teams10.Add(ti);
            }
            CurrentSession.SendAsync(response);
            return(0);
        }
예제 #13
0
        public bool SaveNewTeam(string teamName, string sportName)
        {
            TeamInfo team = new TeamInfo()
            {
                TeamName  = teamName,
                TeamSport = new SportInfo()
                {
                    SportName = sportName
                }
            };

            var client  = new RestClient(sportsAPI);
            var request = new RestRequest("AddTeam", Method.POST);

            request.AddJsonBody(team);

            var response = client.Execute(request);

            if (response.IsSuccessful)
            {
                return(true);
            }

            return(false);
        }
예제 #14
0
        private bool ShouldKick(Position playerWithBallPosition, TeamInfo opposition, Player closestOurPlayer, DirectionType goalPostDirection)
        {
            double oldDistance = 1000;

            foreach (var p in opposition.players)
            {
                var distance = GameHelper.GetDistance(playerWithBallPosition, p.dynamicState.position);

                if (distance < oldDistance)
                {
                    oldDistance = distance;
                }
            }

            if (oldDistance < Int32.Parse(ConfigurationManager.AppSettings["ClosestOpponentDistanceForKick"]))
            {
                if (goalPostDirection == DirectionType.LEFT)
                {
                    if (closestOurPlayer.dynamicState.position.x < playerWithBallPosition.x && GameHelper.GetDistance(closestOurPlayer.dynamicState.position, playerWithBallPosition) > Int32.Parse(ConfigurationManager.AppSettings["ClosestPlayerToPassMinDistance"]))
                    {
                        return(true);
                    }
                }
                else
                {
                    if (closestOurPlayer.dynamicState.position.x > playerWithBallPosition.x && GameHelper.GetDistance(closestOurPlayer.dynamicState.position, playerWithBallPosition) > Int32.Parse(ConfigurationManager.AppSettings["ClosestPlayerToPassMinDistance"]))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #15
0
    public void UpdateUserTeams()
    {
        TeamInfo[]             userTeams   = DataManager.Instance.UserTeams;
        TeamInfo               currentTeam = userTeams[0];
        List <List <TeamBot> > allTeams    = new List <List <TeamBot> >()
        {
            team1, team2, team3
        };

        IEnumerator <List <TeamBot> > allTeamsEnum = allTeams.GetEnumerator();

        allTeamsEnum.MoveNext();


        foreach (var team in userTeams)
        {
            team.Bots = allTeamsEnum.Current.ConvertAll(teamBot => teamBot.BotInfo).ToArray();

            StartCoroutine(DataManager.Instance.UpdateTeam(team, success =>
            {
                if (!success)
                {
                    Debug.Log("teams not updated");
                    return;
                }
            }));
            allTeamsEnum.MoveNext();
        }
        allTeamsEnum.Dispose();
    }
예제 #16
0
        private static List <Team> GetTeamData()
        {
            string   teamDataJSON     = System.IO.File.ReadAllText(@"C:\Users\sbekal\Dropbox\FPL\Team_Info.json");
            TeamInfo teamDataResponse = JsonConvert.DeserializeObject <TeamInfo>(teamDataJSON);

            return(teamDataResponse.teams);
        }
예제 #17
0
        private static void SaveTeamXML(IList <ChatStore> teamChatList)
        {
            TeamXmlInfo info = new TeamXmlInfo();

            info.DisplayName = LoginUserInfo.DisplayName;
            info.UserName    = LoginUserInfo.UserName;
            info.Teams       = new List <TeamInfo>();
            foreach (ChatStore chat in teamChatList)
            {
                TeamInfo team = new TeamInfo();
                team.groupid       = chat.ChatUserName;
                team.groupname     = chat.ChatDisplayName;
                team.groupuserList = chat.TeamMembers.ToList();
                info.Teams.Add(team);
            }

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TeamXML");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fileName = Path.Combine(path, "群组" + info.UserName + ".xml");

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }
            XmlHelper.SerializerToFile(info, fileName);
        }
예제 #18
0
파일: Login.cs 프로젝트: thinhils/Teach
        private void CreateXML()
        {
            TeamXmlInfo xml = new TeamXmlInfo();

            xml.DisplayName = "老师111";
            xml.UserName    = "******";
            xml.Teams       = new List <TeamInfo>();
            for (int i = 0; i < 5; i++)
            {
                TeamInfo team = new TeamInfo();
                team.groupname     = "群组" + i;
                team.groupid       = Guid.NewGuid().ToString();
                team.groupuserList = new List <TeamMember>();
                for (int j = 0; j < 5; j++)
                {
                    TeamMember member = new TeamMember();
                    member.DisplayName = team.groupname + "成员" + j;
                    member.UserName    = Guid.NewGuid().ToString();
                    team.groupuserList.Add(member);
                }
                xml.Teams.Add(team);
            }
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TeamXML");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fileName = Path.Combine(path, "群组" + xml.UserName + ".xml");

            XmlHelper.SerializerToFile(xml, fileName);
            TeamXmlInfo xml2 = XmlHelper.DeserializeFromFile <TeamXmlInfo>(fileName);
        }
예제 #19
0
        // Missing roles
        public static IEnumerable <WorkerRole> GetMissingRolesFull(TeamInfo team)
        {
            var hasProgrammers = team.Roles.Values.Any(r => r == WorkerRole.Programmer);
            var hasMarketers   = team.Roles.Values.Any(r => r == WorkerRole.Marketer);

            var hasLeader = HasMainManagerInTeam(team);

            // hire programmers / marketers first
            // then you can add leads and stuff

            if (hasProgrammers && hasMarketers)
            {
                return(Teams.GetMissingRoles(team));
            }
            else
            {
                var list = new List <WorkerRole>()
                {
                    WorkerRole.Marketer, WorkerRole.Programmer
                };
                var leadRole = GetMainManagerRole(team);

                if (!hasLeader)
                {
                    return new List <WorkerRole>()
                           {
                               leadRole
                           }
                }
                ;

                list.Add(leadRole);
                return(list);
            }
        }
예제 #20
0
 private void PopulateRelationProperties(string teamName, TeamInfo result)
 {
     result.TeamMembers = this.context.TeamMembers.Where(tm => tm.TeamId == teamName).Select(tm => new MilestoneTracker.Contracts.TeamMember {
         Name = tm.MemberId, IncludeInReports = tm.IncludeInReports
     }).ToArray();
     result.Repositories = this.context.TeamRepos.Where(tr => tr.TeamId == teamName).Select(tr => tr.RepoId).ToArray();
 }
예제 #21
0
        public override void Unpack(byte[] data)
        {
            Reset(data);

            GameStyle   = (GameTypes)ReadUInt16();
            GameOptions = (GameOptionFlags)ReadUInt16();
            MaxPlayers  = ReadUInt16();
            MaxShots    = ReadUInt16();

            TeamData.Clear();
            for (TeamColors t = TeamColors.RogueTeam; t <= TeamColors.ObserverTeam; t++)
            {
                TeamInfo info = new TeamInfo();
                info.Team = t;
                info.Size = ReadUInt16();
                TeamData.Add(t, info);
            }
            for (TeamColors t = TeamColors.RogueTeam; t <= TeamColors.ObserverTeam; t++)
            {
                TeamInfo info = TeamData[t];
                info.Max = ReadUInt16();
            }

            ShakeWins    = ReadUInt16();;
            ShakeTimeout = ReadUInt16();;

            MaxPlayerScore = ReadUInt16();;
            MaxTeamScore   = ReadUInt16();;
            ElapsedTime    = ReadUInt16();;
        }
예제 #22
0
    private void InfoSum()
    {
        TeamData[] teams = GroupNetwork.GetTeamInfos();

        mTotalTeamList.Clear();

        if (null == teams || teams.Length <= 0)
        {
            return;
        }

        //生成队的对象,并赋数据
        for (int i = 0; i < teams.Length; i++)
        {
            if (teams[i].Members.Count == 0)
            {
                continue;
            }

            TeamInfo tc = new TeamInfo();
            tc._group = teams[i].TeamId;
            foreach (PlayerNetwork pnet in teams[i].Members)
            {
                //lz-2016.11.28 错误 #6982 Crash bug
                if (null != pnet && null != pnet.Battle)
                {
                    tc._killCount  += pnet.Battle._killCount;
                    tc._deathCount += pnet.Battle._deathCount;
                    tc._point      += pnet.Battle._point;
                }
            }
            mTotalTeamList.Add(tc);
        }
    }
예제 #23
0
    public void LoadInfo(BotInfo botInfo, TeamInfo teamInfo)
    {
        team = teamInfo;
        info = botInfo;

        maxHealth = info.Equipment.Sum(part => part.Attributes.GetOrDefault("health", 0f)) +
                    info.BodyType.Attributes.GetOrDefault("health", 0f);
        weight = info.Equipment.Sum(part => part.Attributes.GetOrDefault("weight", 0f)) +
                 info.BodyType.Attributes.GetOrDefault("weight", 0f);

        LoadParts();

        usesDemoBehaviors = info.Behaviors.Count == 0;

        if (usesDemoBehaviors)
        {
            AddDemoBehaviors();
        }
        else
        {
            LoadBehaviors();
        }

        var rigidbodyComponent = gameObject.GetComponent <Rigidbody2D>();

        if (rigidbodyComponent != null)
        {
            rigidbodyComponent.mass = weight / 100f;
        }
    }
예제 #24
0
        public static Bonus <int> GetManagerGrowthBonus(GameEntity worker, TeamInfo teamInfo, bool hasTeacherInTeam, GameContext gameContext)
        {
            var rating = Humans.GetRating(worker);

            bool isCurious = worker.humanSkills.Traits.Contains(Trait.Curious);

            var bonus = new Bonus <int>("Growth");

            bonus
            //.Append("Base", 25)
            .Append("Rating", (int)Mathf.Pow(100 - rating, 0.95f))
            .AppendAndHideIfZero("Curious", isCurious ? 15 : 0)
            .AppendAndHideIfZero("Works with Teacher", hasTeacherInTeam ? 7 : 0)
            ;

            // market complexity
            // worker current rating (noob - fast growth, senior - slow)
            // trait: curious
            // consultant
            // loyalty change

            bonus.Cap(0, (rating < 100) ? 100 : 0);

            return(bonus);
        }
        public async void Test_Delete_TeamInfo()
        {
            //Arrange
            var db        = DbSource.CreateDbSource();
            var c         = new TeamInfoesController(db);
            var teamInfoe = new TeamInfo
            {
                TeamInfoId   = 2,
                TeamName     = "Newmarket",
                TeamLogoURL  = "",
                TeamDivision = "Adult",
                HomeField    = "Stadium",
                TeamManager  = "Andrew"
            };

            //Act
            await c.Create(teamInfoe);

            var r = await c.Delete(2);

            //Assert
            var result = Assert.IsType <ViewResult>(r);
            var model  = Assert.IsAssignableFrom <TeamInfo>(result.ViewData.Model);

            Assert.Equal(db.TeamInfo.Find(2), model);
        }
예제 #26
0
        public async Task Telemetry_LogTeamsProperties()
        {
            // Arrange
            var mockTelemetryClient = new Mock <IBotTelemetryClient>();

            var adapter = new TestAdapter(Channels.Msteams)
                          .Use(new TelemetryLoggerMiddleware(mockTelemetryClient.Object));

            var teamInfo    = new TeamInfo("teamId", "teamName");
            var channelData = new TeamsChannelData(null, null, teamInfo, null, new TenantInfo("tenantId"));
            var activity    = MessageFactory.Text("test");

            activity.ChannelData = channelData;
            activity.From        = new ChannelAccount("userId", "userName", null, "aadId");

            // Act
            await new TestFlow(adapter)
            .Send(activity)
            .StartTestAsync();

            // Assert
            Assert.Equal("BotMessageReceived", mockTelemetryClient.Invocations[0].Arguments[0]);
            Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1])["TeamsUserAadObjectId"] == "aadId");
            Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1])["TeamsTenantId"] == "tenantId");
            Assert.True(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1])["TeamsTeamInfo"] == JsonConvert.SerializeObject(teamInfo));
        }
예제 #27
0
        public async Task <IActionResult> PutTeamInfo([FromRoute] int id, [FromBody] TeamInfo teamInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != teamInfo.TeamInfoId)
            {
                return(BadRequest());
            }

            _context.Entry(teamInfo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TeamInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #28
0
        public override void execute()
        {
            Console.WriteLine("this is process start command");
            //Console.WriteLine("assigned to" + this.AssignTo);
            TeamInfo teamInfo = TeamInfoAccess.getTeam(0);
            string   bugId    = "N/A";

            using (PSDataAccess psDataAccess = new PSDataAccess(teamInfo.domain, teamInfo.product))
            {
                bugId = "bug12345";
            }

            TrackingDataContext tdc = new TrackingDataContext();

            CommonResource.Tracking t = new CommonResource.Tracking();
            t.wfname       = this.WFName;
            t.bugid        = bugId;
            t.wfinstanceid = new Guid(this.InstanceId);
            t.lastmodified = DateTime.Now;
            t.assignedto   = this.AssignedTo;
            t.title        = this.Title;
            t.qfestatus    = this.qFEStatus;

            //t.qfestatus=
            t.lastmodifiedby = AuthenticationHelper.GetCurrentUser();
            tdc.Trackings.InsertOnSubmit(t);
            tdc.SubmitChanges();
        }
예제 #29
0
    public void Save()
    {
        if (File.Exists(Application.persistentDataPath + "/cache.txt"))
        {
            BinaryFormatter loadF    = new BinaryFormatter();
            FileStream      loadFile = File.Open(Application.persistentDataPath + "/cache.txt", FileMode.Open);
            TeamsDatabase = (List <TeamInfo>)loadF.Deserialize(loadFile);
            loadFile.Close();
        }

        BinaryFormatter saveF    = new BinaryFormatter();
        FileStream      saveFile = File.Create(Application.persistentDataPath + "/cache.txt");
        TeamInfo        saveTeam = new TeamInfo();

        saveTeam.UserID             = 0;
        saveTeam.Name               = "Atharva Khare";
        saveTeam.jigsawPuzzleName1  = "Puzzle1";
        saveTeam.jigsawPuzzleName2  = "Puzzle2";
        saveTeam.jigsawPuzzleName3  = "Puzzle3";
        saveTeam.fourPicPuzzleName1 = saveTeam.fourPicPuzzleName2 = saveTeam.fourPicPuzzleName3 = "Puzzle4";
        saveTeam.riddle1            = saveTeam.riddle2 = saveTeam.riddle3 = "Puzzle5";
        TeamsDatabase.Add(saveTeam);
        TeamInfo saveTeam1 = new TeamInfo();

        saveTeam1.UserID = 1;
        saveTeam1.Name   = "TEMP";
        TeamsDatabase.Add(saveTeam1);
        saveF.Serialize(saveFile, TeamsDatabase);
        saveFile.Close();
    }
예제 #30
0
        private void Grid_MouseUp_1(object sender, MouseButtonEventArgs e)
        {
            TeamInfo ti = (sender as Grid).DataContext as TeamInfo;

            if (ti.ImagePath.Contains("Exit"))
            {
                Storyboard sb3 = this.FindResource("Storyboard1") as Storyboard;
                sb3.Begin(this);

                Storyboard sb = teamList.FindResource("Storyboard2") as Storyboard;
                Grid       g  = VisualTreeHelper.GetChild(teamList, 0) as Grid;
                sb.Begin(g);

                Storyboard sb2 = infoList.FindResource("Storyboard1") as Storyboard;
                Grid       g2  = VisualTreeHelper.GetChild(infoList, 0) as Grid;
                sb2.Begin(g2);

                Storyboard sb4 = playerList.FindResource("Storyboard1") as Storyboard;
                Grid       g3  = VisualTreeHelper.GetChild(playerList, 0) as Grid;
                sb4.Begin(g3);
            }
            else if (ti.ImagePath.Contains("Ambulance"))
            {
                Storyboard sb3 = playerList.FindResource("Storyboard2") as Storyboard;
                Grid       g3  = VisualTreeHelper.GetChild(playerList, 0) as Grid;
                sb3.Begin(g3);
            }
        }
예제 #31
0
    public void setTeam(TeamInfo T)
    {
        team = T;
        Color32 scoreBitColor = team.beaconColor;
        scoreBitColor.a = 170;

        //	renderer.material.color = scoreBitColor;
        renderer.material.color = new Color32(237, 20, 90, 180);

        finalTarget = T.ScoreBar.transform.FindChild ("ScoreBitFinalTarget").gameObject.GetComponent<FinalScoreTarget>();
    }
예제 #32
0
    public static TeamInfo GetTeamInfo(int teamNumber)
    {
        TeamInfo returnable = new TeamInfo ();
        switch (teamNumber) {
            case 1:
                returnable.teamColor = new Color32 (17, 75, 141, 255);
                returnable.teamColorAlt = new Color32 (80, 204, 204, 255);
                returnable.tileColor = new Color32 (88, 151, 209,255);
                returnable.beaconColor = new Color32 (108, 55, 168, 255);
            // maybe purple 133, 75, 198, 255
            //good beacon color (21, 86, 163, 255)
                returnable.startingLocation = Settings.SettingsInstance.team1Start;
                returnable.teamNumber = teamNumber;
                returnable.highlightColor = new Color32 (17, 75, 141, 150);
                returnable.scoreTexture = (Texture)Resources.Load("Sprites/ScorebgTextureblue");
            returnable.winTexture = (Texture)Resources.Load("Sprites/victoryBackground3");
            //returnable.winTexture = (Texture)Resources.Load("Sprites/vicBackBlue");
                break;
            case 2:
                returnable.teamColor = new Color32 (247, 180, 40, 255);
                returnable.teamColorAlt = new Color32 (247, 90, 40, 255);
                returnable.tileColor = new Color32 (255, 190, 50,255);
        //		returnable.beaconColor = new Color32 (0, 165, 80, 255);
                returnable.beaconColor = new Color32 (249, 98, 45, 255);
            //239, 110, 34, 255
                returnable.startingLocation = Settings.SettingsInstance.team2Start;
                returnable.teamNumber = teamNumber;
                returnable.highlightColor = new Color32 (247, 180, 40, 150);
            returnable.scoreTexture = (Texture)Resources.Load("Sprites/ScorebgTexturebyel");
            returnable.winTexture = (Texture)Resources.Load("Sprites/victoryBackground3");
            //returnable.winTexture = (Texture)Resources.Load("Sprites/vicBackYel");
                break;
        }

        byte colorOffset = 0;
        for(int i = 0;  i< Settings.SettingsInstance.marqueeCount; i++){
            Color32 c = new Color32(
            ((byte) (returnable.tileColor.r-colorOffset) > 0) ? (byte)(returnable.tileColor.r-colorOffset): (byte)1  ,
                                    ((byte)(returnable.tileColor.g-colorOffset) >= 0) ? (byte)(returnable.tileColor.g-colorOffset) : (byte)1 ,
                                    ((byte)(returnable.tileColor.b-colorOffset)>= 0) ? (byte)(returnable.tileColor.b-colorOffset) : (byte)1,
            (byte)255);
            returnable.marqueeColorList.Insert (0,c);
            colorOffset +=3;
        }
        return returnable;
    }
예제 #33
0
    public static TeamInfo GetTeamInfo(int teamNumber)
    {
        TeamInfo returnable = new TeamInfo ();
        switch (teamNumber) {
            case 1:
                returnable.teamColor = new Color32 (17, 75, 141, 255);
                returnable.tileColor = new Color32 (88, 151, 209,255);
                returnable.beaconColor = new Color32 (21, 86, 163, 255);
                returnable.startingLocation = Settings.SettingsInstance.team1Start;
                returnable.teamNumber = teamNumber;
                returnable.highlightColor = new Color32 (17, 75, 141, 150);

                break;
            case 2:
                returnable.teamColor = new Color32 (247, 180, 40, 255);
                returnable.tileColor = new Color32 (255, 190, 50,255);
        //		returnable.beaconColor = new Color32 (0, 165, 80, 255);
                returnable.beaconColor = new Color32 (240, 139, 32, 255);
                returnable.startingLocation = Settings.SettingsInstance.team2Start;
                returnable.teamNumber = teamNumber;
                returnable.highlightColor = new Color32 (247, 180, 40, 150);
                break;
        }

        byte colorOffset = 0;
        for(int i = 0;  i< Settings.SettingsInstance.marqueeCount; i++){
            Color32 c = new Color32(
            ((byte) (returnable.tileColor.r-colorOffset) > 0) ? (byte)(returnable.tileColor.r-colorOffset): (byte)1  ,
                                    ((byte)(returnable.tileColor.g-colorOffset) >= 0) ? (byte)(returnable.tileColor.g-colorOffset) : (byte)1 ,
                                    ((byte)(returnable.tileColor.b-colorOffset)>= 0) ? (byte)(returnable.tileColor.b-colorOffset) : (byte)1,
            (byte)255);
            returnable.marqueeColorList.Insert (0,c);
            colorOffset +=3;
        }
        return returnable;
    }
예제 #34
0
 public BaseTile getClosestOpenTile(BaseTile ToCheck, TeamInfo T, GetLocalTiles locals)
 {
     List<BaseTile> open = locals(ToCheck, T);
     BaseTile returnable = null;
     int minVal = int.MaxValue;
     open.ForEach(delegate(BaseTile obj) {
         if(ToCheck.calcHueristic(ToCheck, obj) < minVal){ returnable = obj; minVal = ToCheck.calcHueristic(ToCheck, obj);}
     });
     return returnable;
 }
예제 #35
0
 public void setTeam(TeamInfo T)
 {
     team = T;
     //	renderer.material.color = team.getHighLightColor();
 }
예제 #36
0
파일: Altar.cs 프로젝트: Chargeorge/Studio2
    public void setControl(TeamInfo team)
    {
        if(!isLocked){
            if(team!=null) {
                Color32 copy = team.beaconColor;
                //renderer.material.color = copy;
                //renderer.material.color = team.teamColor;

                _currentControllingTeam = team;
                checkNetwork();
        //				StartCoroutine(AnimateTiles());
                copy.a = 200;
                symbol.renderer.material.color = copy;

                //TODO - fix - not sure why this doesn't work...
                if (!sRef.optLockTile) {
                    //Update all existing beacons to match new altar effects
                    GameObject[] beacons = GameObject.FindGameObjectsWithTag("Beacon");
                    foreach (GameObject go in beacons) {
                        go.GetComponent<Beacon>().UpdateInfluencePatterns();
                    }
                }

            }else{

                //pink (237, 20, 90, 255)
                //symbol.renderer.material.color = new Color32(255, 255, 255, 255);
            }
        }
    }
예제 #37
0
파일: Altar.cs 프로젝트: Chargeorge/Studio2
    public bool doCapture(TeamInfo T)
    {
        //Doesn't get called anymore

        if(sRef.optLockTile){
            if(!isLocked){
                if(currentControllingTeam.teamNumber == T.teamNumber){
                    if(networked){
                        isLocked = true;
                        Hashtable ht = new Hashtable();
                        ht.Add("x",.5f);
                        ht.Add("y",.5f);
                        ht.Add("time",.50f);
                        iTween.ShakePosition(gameObject, ht);

                        //Update all existing beacons to match new altar effects
                        GameObject[] beacons = GameObject.FindGameObjectsWithTag("Beacon");
                        foreach (GameObject go in beacons) {
                            go.GetComponent<Beacon>().UpdateInfluencePatterns();
                        }
                        return true;
                    }
                }
            }
        }
        return false;
    }
예제 #38
0
 public void addTeam(TeamInfo teamInfo)
 {
     //print(teamInfo.teamName);
     teamNameList.Add(teamInfo.teamName);
     teamLoseInfoList[teamInfo.teamName] = new TeamData();
 }
예제 #39
0
    public void setTeam(TeamInfo teamIn)
    {
        if(teamIn != null){controllingTeam = teamIn;
        Color32 controllingTeamColor = controllingTeam.beaconColor;
            Color32 platformColor = controllingTeam.tileColor;
        //TODO: custom sprites and colors per team
        controllingTeamColor.a = (byte)(transform.FindChild("Arrow").renderer.material.color.a * 255);
        controllingTeamColor.a = (byte)(transform.FindChild("Base").renderer.material.color.a * 255);
            platformColor.a = (byte)(transform.FindChild("Platform").renderer.material.color.a * 255);

            transform.FindChild("Arrow").renderer.material.color = controllingTeamColor;
            transform.FindChild("Base").renderer.material.color = controllingTeamColor;
            transform.FindChild("Anim").renderer.material.color = controllingTeamColor;
            transform.FindChild("Platform").renderer.material.color = platformColor;
        }
        else{

            neutralColor = new Color32 (100, 100, 100, 255);
            neutralColorB = new Color32 (200, 200, 200, 255);

            controllingTeam = null;
            transform.FindChild("Arrow").renderer.material.color = neutralColor;
            transform.FindChild("Base").renderer.material.color = neutralColor;
            transform.FindChild("Platform").renderer.material.color = neutralColorB;
        }
    }
예제 #40
0
 /// <summary>
 /// adds influence, if influence is maxed it returns true
 /// </summary>
 /// <returns><c>true</c>, if progress to influence was added, <c>false</c> otherwise.</returns>
 /// <param name="rate">Rate.</param>
 /// <param name="newTeam">New team.</param>
 public bool addProgressToInfluence(float rate, TeamInfo newTeam)
 {
     bool returnable  = false;
     if(controllingTeam != null && controllingTeam.teamNumber != newTeam.teamNumber){
         percControlled -= rate*Time.deltaTime;
         if(percControlled <=0) {
             percControlled = 0;
             flipInfluence(newTeam);
         }
     }else{
         if(controllingTeam == null){
             startInfluence(rate*Time.deltaTime, newTeam);
         }
         else{
             percControlled += rate*Time.deltaTime;
             if(percControlled >= 100) {
                 finishInfluence();
                 audio.PlayOneShot(influenceDone, 0.7f); //activate this if we want every tile influenced to trigger a sound, including the ones influenced by beacons
                 returnable = true;
             }
         }
     }
     return returnable;
 }
예제 #41
0
    public void clearInfluence()
    {
        percControlled = 0;
        controllingTeam = null;
        owningTeam = null;

        Beacon localBeacon = GetComponentInChildren<Beacon>();
        Altar localAltar = GetComponentInChildren<Altar>();
    }
 public void Insert(TeamInfo info)
 {
     _teamData.Insert(info);
 }
예제 #43
0
 /*void OnMouseOver() {
     GameObject.Find("GameManager").GetComponent<GameManager>().debugMouse = this;
 }*/
 TeamInfo getHomeTeam(TeamInfo t)
 {
     Home homeBase = GetComponentInChildren<Home>();
     if (homeBase != null){
         return homeBase.team;
     }
     else{
         return null;
     }
 }
예제 #44
0
    /// <summary>
    /// Subtract any influence, return any influence over the flip
    /// </summary>
    /// <returns>The tract influence.</returns>
    /// <param name="rate">Rate.</param>
    public float subTractInfluence(float amt, TeamInfo subtractingTeam)
    {
        if(percControlled > 0){
            percControlled -= amt;

            return 0f;
        }

        else{
            float returnable = Math.Abs (percControlled);
            flipInfluence(subtractingTeam);
            return returnable;

        }
    }
예제 #45
0
 public void startInfluence(float initialProgress, TeamInfo team)
 {
     ///TODO: add start semaphore stuff here
     currentState = TileState.beingInfluenced;
     controllingTeam = team;
     percControlled = initialProgress;
 }
예제 #46
0
    /// <summary>
    /// Finish adding influence, set which team controls it
    /// </summary>
    public void finishInfluence()
    {
        ///TODO: add end semaphore stuff her
        if(controllingTeam != owningTeam){
            if(_percControlled > 100f){
                _percControlled = 100f;
                currentState = TileState.normal;
                if(controllingTeam.teamNumber == 1)	audio.clip = sRef.InfluenceDoneLo;
                if(controllingTeam.teamNumber == 2) audio.clip = sRef.InfluenceDoneHi;

                if (!audio.isPlaying) {
                    audio.volume = sRef.playerInfluenceDoneVolume;
                    audio.Play (); //activate this if we want every tile influenced to trigger a sound, including the ones influenced by beacons
                }

            }
            owningTeam = controllingTeam;
            Beacon localBeacon = GetComponentInChildren<Beacon>();
            Altar localAltar = GetComponentInChildren<Altar>();
            owningTeam.ScoreFromTile (getTileScore ());

            if(localAltar !=null){
                localAltar.setControl(owningTeam);
            }
            if(localBeacon!= null){
                localBeacon.setTeam (owningTeam);
                localBeacon.UpdateInfluencePatterns();
            }

            Reveal (sRef.influenceRevealRange);
            //TODO: possible huge performance hit here
            gm.tileSendMessage("setDistanceToHomeBase");
            //setDistanceToHomeBase();
            PS.startColor = controllingTeam.beaconColor;
            PS.Emit(100);

        }
    }
예제 #47
0
 /// <summary>
 /// adds influence, if influence is maxed it returns true
 /// </summary>
 /// <returns><c>true</c>, if progress to influence was added, <c>false</c> otherwise.</returns>
 /// <param name="rate">Rate.</param>
 /// <param name="newTeam">New team.</param>
 public bool addProgressToInfluence(float rate, TeamInfo newTeam)
 {
     bool returnable  = false;
     if(controllingTeam != null && controllingTeam.teamNumber != newTeam.teamNumber){
         _percControlled -= rate*Time.deltaTime;
         influenceThisFrame -= rate*Time.deltaTime;
         if(_percControlled <=0) {
             _percControlled = 0;
             flipInfluence(newTeam);
         }
     }else{
         if(controllingTeam == null){
             startInfluence(rate*Time.deltaTime, newTeam);
         }
         else{
             _percControlled += rate*Time.deltaTime;
             influenceThisFrame += rate*Time.deltaTime;
             if(_percControlled >= 100) {
                 finishInfluence();
                 returnable = true;
             }
         }
     }
     return returnable;
 }
예제 #48
0
 /// <summary>
 ///  STUB method
 /// </summary>
 /// <returns>The local open tiles.</returns>
 /// <param name="currentAp">Current ap.</param>
 public static List<BaseTile> getLocalTraversableTiles(BaseTile current, TeamInfo T)
 {
     //	if(
     List<BaseTile> returnable = current.getLocalTiles();
     returnable.RemoveAll(x => x.currentType == TileTypeEnum.water);
     return returnable;
 }
예제 #49
0
    public void startBuilding(GameObject tileLocation, GameObject player, float valInit)
    {
        this.gameObject.transform.parent = tileLocation.transform;

        this.facing = player.GetComponentInChildren<Player>().facing;
        this.dirRotatingToward = facing;
        this._currentState	= BeaconState.BuildingBasic;
        if (controllingTeam == null) {
            controllingTeam = player.GetComponentInChildren<Player>().team;
            this.setTeam();
        }
        this.transform.localPosition = new Vector3(0f,0f,-.5f);
        tileLocation.GetComponent<BaseTile>().beacon = this.gameObject;

        this.transform.FindChild("Base").localPosition = new Vector3(0f,0f,-.1f);
        //Debug.Log(this.transform.FindChild("Base").localPosition);

        audio.Stop ();
        audio.PlayOneShot(beaconBuilding, 0.9f);
    }
예제 #50
0
 public static List<BaseTile> getLocalSameTeamTiles(BaseTile current, TeamInfo T)
 {
     List<BaseTile> returnable = current.getLocalTiles();
     returnable.RemoveAll(x => x.owningTeam == null);
     returnable.RemoveAll(x => x.owningTeam.teamNumber != T.teamNumber);
     return returnable;
 }
예제 #51
0
 /// <summary>;
 /// Change teams, part of the setup process
 /// </summary>
 /// <param name="t">T.</param>
 public void SetTeam(TeamInfo t)
 {
     team = t;
     MoveToTeamStart ();
 }
예제 #52
0
 public static List<BaseTile> getLocalNonTiles(BaseTile current, TeamInfo T)
 {
     return null;
 }
예제 #53
0
    public static List<AStarholder> aStarSearch(BaseTile start, BaseTile end, int currentAp, GetLocalTiles LocalMethod, TeamInfo team)
    {
        Dictionary<int, AStarholder> closedSet  = new Dictionary<int, AStarholder>();
        Dictionary<int, AStarholder> openSet = new Dictionary<int, AStarholder>();

        AStarholder current = new AStarholder(start, null);
        current.hurVal = current.current.calcHueristic(current.current, end);
        //current.apAtThisTurn = currentAp;
        current.pathCostToHere = 0;

        openSet.Add(current.current.Ident, current);
        List<AStarholder> returnable = new List<AStarholder>();
        while (openSet.Count >0){
            openSet.Remove(current.current.Ident);
            closedSet.Add(current.current.Ident, current);

            if(current.current.Ident == end.Ident){ BaseTile.reconstructPath(start, current, returnable); return returnable;}

            List<BaseTile> listies =LocalMethod(current.current, team);
            listies.ForEach(delegate (BaseTile bt){
                if(!closedSet.ContainsKey(bt.Ident)){
                    AStarholder newOpen = new AStarholder(bt, current);
                    newOpen.hurVal = newOpen.current.calcHueristic(newOpen.current, end);
                    //newOpen.apAtThisTurn = current.apAtThisTurn - newOpen.current.MoveCost;
                    newOpen.pathCostToHere = newOpen.current.MoveCost + current.pathCostToHere;
                    if(openSet.ContainsKey(bt.Ident)){
                        if(openSet[bt.Ident].fVal > newOpen.fVal){
                            openSet[bt.Ident] = newOpen;
                        }
                    }
                    else{
                        openSet.Add (bt.Ident, newOpen);
                    }
                }
            });
            current = null;
            foreach(KeyValuePair<int, AStarholder> val in openSet){
                if(current == null){
                    current = val.Value;
                }
                if(current.fVal > val.Value.fVal){
                    current = val.Value;
                }
            }
        }
        //Ran out of moves, find the lowest HurVal and return path to it

        AStarholder finalNode = null;
        foreach(KeyValuePair<int, AStarholder> val in openSet){

            if(finalNode == null){
                finalNode = val.Value;
            }
            if(current.fVal > val.Value.fVal){
                finalNode = val.Value;
            }

        }

         BaseTile.reconstructPath(start, finalNode, returnable);
        return returnable;
    }
예제 #54
0
 public void SetVictory(TeamInfo T)
 {
     isCompleted = true;
     completingTeam = T;
 }
예제 #55
0
파일: Altar.cs 프로젝트: Chargeorge/Studio2
 public void setScoreBarTeam(TeamInfo t )
 {
     if(t != null){
         scoreBar.renderer.material.color = t.teamColor;
     }
     else{
         scoreBar.renderer.material.color =  new Color32(220, 30, 47, 255);
     }
 }
예제 #56
0
 public VictoryCondition(int valueIn)
 {
     isCompleted = false;
     this.value = value;
     completingTeam = null;
 }
 public void Update(TeamInfo info)
 {
     _teamData.Update(info);
 }
예제 #58
0
    public bool getActionable(TeamInfo attemptingAction, bool playerInfluencing)
    {
        float influenceOffset = (playerInfluencing) ? sRef.vpsBasePlayerInfluence * Time.deltaTime : 0;
        float averageInfluence = getAverageInfluence();
        if(controllingTeam != attemptingAction){
            //check influence count
            if(averageInfluence + influenceOffset - sRef.vpsBasePlayerInfluence * Time.deltaTime < 0){
                return true;
            }
            else{
                return false;
            }

        }
        else{
            if(beacon != null){
                if(beacon.GetComponent<Beacon>().currentState == BeaconState.Advanced){
                    return false;
                }
                else{
                    return true;
                }
            }
            else{
                if(owningTeam == attemptingAction && !buildable()){
                    return false;
                }
                else{
                    return true;
                }
            }
        }
    }
예제 #59
0
    /// <summary>
    /// Finish adding influence, set which team controls it
    /// </summary>
    public void finishInfluence()
    {
        audio.PlayOneShot(influenceDone, 0.7f);
        ///TODO: add end semaphore stuff her
        if(controllingTeam != owningTeam){
            if(percControlled > 100f){
                percControlled = 100f;
                currentState = TileState.normal;
                //audio.PlayOneShot(influenceDone, 0.7f);

            }
            owningTeam = controllingTeam;
            Beacon localBeacon = GetComponentInChildren<Beacon>();
            Altar localAltar = GetComponentInChildren<Altar>();
            owningTeam.score += getTileScore();

            if(localAltar !=null){
                localAltar.setControl(owningTeam);
            }
            if(localBeacon!= null){

                localBeacon.setTeam (owningTeam);

            }

            Reveal (_influenceRevealRange);
            //TODO: possible huge performance hit here
            gm.tileSendMessage("setDistanceToHomeBase");
            //setDistanceToHomeBase();
            PS.startColor = controllingTeam.beaconColor;
            PS.Emit(100);

        }
    }
예제 #60
0
    /// <summary>
    /// Sets tile to neutral control
    /// </summary>
    /// <param name="newTeam">New team.</param>
    public void flipInfluence(TeamInfo newTeam)
    {
        if(owningTeam != null){
            owningTeam.score -= getTileScore();
        }
        controllingTeam = newTeam;
        percControlled = 0;
        owningTeam = null;

        Beacon localBeacon = GetComponentInChildren<Beacon>();
        Altar localAltar = GetComponentInChildren<Altar>();

        if(localBeacon !=null){

        }
        if(localAltar !=null){
            localAltar.setControl(null);
        }
        //TODO: possible huge performance hit here
        gm.tileSendMessage("setDistanceToHomeBase");
    }