Beispiel #1
0
    public Transform trans_award;//奖励

    public override void Init(params object[] args)
    {
        base.Init(args);
        int id = (int)args[0];

        SocializationManager.Instance.SetTmpPreferedActionId(id);
        actionSetting = DataTable.FindActionSetting(id);

        EventCenter.Register(TheEventType.NPCAppliedInvite, OnNPCAppliedInvite);
        addBtnListener(btn_invitePeople, () =>
        {
            PanelManager.Instance.OpenPanel <CellPhonePanel>(PanelManager.Instance.trans_layer2, CellphoneHandleType.Invite);
        });

        addBtnListener(btn_go, () =>
        {
            //和他一起去
            if (choosedWithPeople != null)
            {
                RoleManager.Instance.playerPeople.Record("和" + choosedWithPeople.protoData.Name + "一起" + actionSetting.name);
                choosedWithPeople.Record("和" + RoleManager.Instance.playerPeople + "一起" + actionSetting.name);
                SocializationManager.Instance.AddPlan(actionSetting.name, actionSetting.id.ToInt32(), RoleManager.Instance.playerPeople, choosedWithPeople);
                //分别拒绝掉各自的鱼
                SocializationManager.Instance.RefusePeopleWhoInviteMe(RoleManager.Instance.playerPeople, choosedWithPeople, actionSetting.name);
                SocializationManager.Instance.ForgivePeopleWhoIInvite(RoleManager.Instance.playerPeople, choosedWithPeople, actionSetting.name);

                SocializationManager.Instance.RefusePeopleWhoInviteMe(choosedWithPeople, RoleManager.Instance.playerPeople, actionSetting.name);
                SocializationManager.Instance.ForgivePeopleWhoIInvite(choosedWithPeople, RoleManager.Instance.playerPeople, actionSetting.name);

                //这里执行其它npc的邀约
                SocializationManager.Instance.HandleInvite(RoleManager.Instance.allPeopleList);
                GameModuleManager.Instance.InitGameModule(GameModuleType.SingleOutsideScene);

                //其它NPC执行邀约完毕以后,要给玩家发个信息
                SocializationManager.Instance.NPCReactionAfterPeopleChoosePlan(choosedWithPeople);
            }
            else
            {
                //弹窗问独自去还是和人一起去

                PanelManager.Instance.OpenCommonHint("确定独自一个人" + actionSetting.name + "吗?", () =>
                {
                    RoleManager.Instance.playerPeople.Record("决定独自去" + actionSetting.name);
                    SocializationManager.Instance.AddPlan(actionSetting.name, actionSetting.id.ToInt32(), RoleManager.Instance.playerPeople);
                    //拒绝掉我的鱼

                    SocializationManager.Instance.HandleInvite(RoleManager.Instance.allPeopleList);
                    SocializationManager.Instance.NPCReactionAfterPeopleChoosePlan(choosedWithPeople);

                    GameModuleManager.Instance.InitGameModule(GameModuleType.SingleOutsideScene);
                },
                                                     null);
            }
        });

        addBtnListener(btn_close, () =>
        {
            PanelManager.Instance.ClosePanel(this);
        });
    }
Beispiel #2
0
    /// <summary>
    /// NPC答应玩家邀请
    /// </summary>
    /// <param name="people"></param>
    public void NPCApplyPlayerInvite(People people, ActionSetting actionSetting)
    {
        bool doubleAsked = false;

        for (int i = 0; i < people.meInviteOtherList.Count; i++)
        {
            //如果npc也邀请了玩家,则顺从玩家
            if (people.meInviteOtherList[i].people.protoData.OnlyId == RoleManager.Instance.playerPeople.protoData.OnlyId)
            {
                doubleAsked = true;
                break;
            }
            //这里应该直接进入了
            //GameModuleManager.Instance.curGameModule = GameModuleType.SingleOutsideScene;
        }
        WetalkMsgData wetalkMsgData;// = new WetalkMsgData(WetalkMsgType.Nonsense, "嗯,那听你的吧。", people, RoleManager.Instance.playerPeople, 0);

        if (doubleAsked)
        {
            wetalkMsgData = new WetalkMsgData(WetalkMsgType.Nonsense, "嗯,那听你的吧。", people, RoleManager.Instance.playerPeople, 0);
        }
        else
        {
            wetalkMsgData = new WetalkMsgData(WetalkMsgType.Nonsense, "虽然对" + actionSetting.name + "不太感冒,不过和你一起去倒还不错。", people, RoleManager.Instance.playerPeople, 0);
        }
        SendMsgToPlayer(people, RoleManager.Instance.playerPeople, wetalkMsgData);
        RoleManager.Instance.playerPeople.protoData.ValidWithPeople.Add(people.protoData.OnlyId);
        //该NPC把鱼拒绝掉(这个不一定 看后续需不需要这样做TODO
        RefusePeopleWhoInviteMe(people, RoleManager.Instance.playerPeople, RoleManager.Instance.playerPeople.actionName);
        ForgivePeopleWhoIInvite(people, RoleManager.Instance.playerPeople, RoleManager.Instance.playerPeople.actionName);
        //刷新面板显示
        EventCenter.Broadcast(TheEventType.NPCAppliedInvite);
    }
Beispiel #3
0
    public void InviteCalc()
    {
        //定计划
        for (int i = 0; i < RoleManager.Instance.NPCPeopleList.Count; i++)
        {
            People        me      = RoleManager.Instance.NPCPeopleList[i];
            List <People> tmpList = new List <People>();

            //tmpList.Clear();
            List <ActionSetting> actionSettingList = DataTable._actionList;
            int           actionIndex   = RandomManager.Next(0, actionSettingList.Count);
            ActionSetting actionSetting = actionSettingList[actionIndex];
            me.actionName         = actionSetting.name;
            me.protoData.ActionId = actionSetting.id.ToInt32();
            //邀请0-5人(不能重复邀请
            if (me.protoData.WetalkFriends.Count > 0 && actionSetting.socializationType.ToInt32() != (int)ActionSocializationProperty.MustAlone)
            {
                //暂时一定邀请 这里改成1
                int num = RandomManager.Next(0, me.protoData.WetalkFriends.Count + 1);
                if (num > 0)
                {
                    for (int j = 0; j < num; j++)
                    {
                        People choosed = null;
                        while (choosed == null ||
                               choosed == me ||
                               tmpList.Contains(choosed))
                        {
                            int index = RandomManager.Next(0, me.protoData.WetalkFriends.Count);
                            choosed = RoleManager.Instance.FindPeopleWithOnlyId(me.protoData.WetalkFriends[index]);
                        }
                        tmpList.Add(choosed);
                        if (choosed.isPlayer)
                        {
                            WetalkMsgData wetalkMsgData = new WetalkMsgData(WetalkMsgType.InviteAction,
                                                                            "一起" + actionSetting.name + "吗?", me, choosed, me.protoData.ActionId);
                            SendMsgToPlayer(me, choosed, wetalkMsgData);
                            //SendMsgToPlayer(me, choosed, actionSetting);TODO
                        }
                        me.Invite(choosed);
                        me.Record("邀请" + choosed.protoData.Name + me.actionName);
                        choosed.Record("被" + me.protoData.Name + "邀请" + me.actionName);
                    }
                }
                else
                {
                    me.Record("想今天一个人" + me.actionName);
                }
            }

            else
            {
                //planList.Add(new Plan(me.actionName, me, null));
                me.Record("想今天一个人" + me.actionName);
            }
        }

        //这里如果玩家有被邀请,则发一封信给玩家
    }
    public override void Init(params object[] args)
    {
        base.Init(args);
        int theId = (int)args[1];

        actionSetting = DataTable.FindActionSetting(theId);
        txt.SetText(actionSetting.name);
    }
Beispiel #5
0
    /// <summary>
    /// 邀请npc
    /// </summary>
    public void InviteNPC(People people)
    {
        ActionSetting actionSetting = DataTable.FindActionSetting(RoleManager.Instance.playerPeople.protoData.ActionId);

        WetalkMsgData wetalkMsgData = new WetalkMsgData(WetalkMsgType.Nonsense, "一起" + actionSetting.name + "吗?", RoleManager.Instance.playerPeople, people, 0);

        SendMsgToPlayer(RoleManager.Instance.playerPeople, people, wetalkMsgData);
        //NPC把玩家和邀请自己的人和自己邀请的人一起比较,然后酌情拒绝玩家
        List <People> candidateList = new List <People>();//所有可能配对的人的列表

        //List<People> candidateInviteMeList = new List<People>();//邀请我的人的列表
        //List<People> candidateMeInviteOtherList = new List<People>();//我邀请的人的列表

        for (int m = 0; m < people.meInviteOtherList.Count; m++)
        {
            People theOther = people.meInviteOtherList[m].people;
            if (!candidateList.Contains(theOther))
            {
                candidateList.Add(theOther);
            }
        }
        for (int m = 0; m < people.otherInviteMeList.Count; m++)
        {
            People theOther = people.otherInviteMeList[m].people;
            if (!candidateList.Contains(theOther))
            {
                candidateList.Add(theOther);
            }
        }
        //我邀请玩家 玩家也邀请我 则直接答应 并迁就玩家
        if (candidateList.Contains(RoleManager.Instance.playerPeople))
        {
            //这里执行NPC答应玩家的行为
            NPCApplyPlayerInvite(people, actionSetting);
        }
        //没有互相邀请的情况 则随机拒绝或答应
        else
        {
            int val = RandomManager.Next(0, 101);
            //答应
            if (val < 30)
            {
                //这里执行NPC答应玩家的行为
                NPCApplyPlayerInvite(people, actionSetting);
            }
            //拒绝
            else
            {
                //这里执行NPC拒绝玩家的行为
                NPCRefusePlayerInvite(people);
            }
        }
    }
Beispiel #6
0
        public JsonResult CreateActionSetting(ActionSettingVM model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Json(null));
                }
                else
                {
                    var ActionSettingExist = UnitOfWork.ActionSettingBL.CheckExist(b => b.ReservationStatusId == model.ReservationStatusId && b.ActionStepId == model.ActionStepId && b.BranchId == model.BranchId && b.RateSegmentCategoryId == model.RateSegmentCategoryId && b.WeekDayId == model.WeekDayId);
                    if (ActionSettingExist)
                    {
                        return(Json(new { success = false, Message = "Action setting already exists" }));
                    }


                    var ActionSetting = new ActionSetting
                    {
                        ReservationStatusId   = model.ReservationStatusId,
                        ActionStepId          = model.ActionStepId,
                        BranchId              = model.BranchId,
                        RateSegmentCategoryId = model.RateSegmentCategoryId,
                        WeekDayId             = model.WeekDayId,
                    };
                    if (model.IsEnable == null || model.IsEnable == true)
                    {
                        ActionSetting.IsEnable = true;
                    }
                    else
                    {
                        ActionSetting.IsEnable = false;
                    }

                    UnitOfWork.ActionSettingBL.Add(ActionSetting);
                    if (UnitOfWork.Complete() > 0)
                    {
                        return(Json(new { success = true, Message = "Action setting added successfully" }));
                    }
                    else
                    {
                        return(Json(new { success = false, Message = "Failed to add Action setting" }));
                    }
                }
            }
            catch (Exception)
            {
                return(Json(new { success = false, Message = "An error occured , please try again later" }));
            }
        }
Beispiel #7
0
 private void SaveCurrentActionSettings()
 {
     if (_action != null)
     {
         // Save current settings
         NameValueCollection settings = new NameValueCollection();
         sgActionSettings.PopulateSettings(settings);
         foreach (string key in settings.AllKeys)
         {
             ActionSetting actionSetting = _action.Settings.FindByName(key);
             if (actionSetting == null)
             {
                 actionSetting      = new ActionSetting();
                 actionSetting.Name = key;
                 _action.Settings.Add(actionSetting);
             }
             actionSetting.Value = settings[key];
         }
     }
 }
 public override void OnOpenIng()
 {
     base.OnOpenIng();
     Show();
     addBtnListener(btn, () =>
     {
         //如果是邀请 TODO如果已邀请自己的人也做同样的事情 需要过滤掉
         if (parentPanel.curHandleType == CellphoneHandleType.Invite)
         {
             RoleManager.Instance.playerPeople.protoData.ActionId = SocializationManager.Instance.tmpPreferedActionId;
             People people = RoleManager.Instance.FindPeopleWithOnlyId(singlePeopleChatData.Belong);
             ActionSetting actionSetting = Framework.Data.DataTable.FindActionSetting(SocializationManager.Instance.tmpPreferedActionId);
             PanelManager.Instance.OpenCommonHint("确定邀请" + people.protoData.Name + actionSetting.name + "吗?", () =>
             {
                 //打开聊天面板
                 parentPanel.ShowChat(singlePeopleChatData);
                 SocializationManager.Instance.InviteNPC(people);
             },
                                                  null);
         }
     });
 }
    /// <summary>
    /// 结束
    /// </summary>
    void EndGameAction()
    {
        List <AwardData> awardList = new List <AwardData>();

        //玩家和npc的属性都要变化 TODO玩家每次见到的NPC有限 一个图书馆可能只抽出一部分NPC
        for (int i = 0; i < RoleManager.Instance.allPeopleList.Count; i++)
        {
            People             people        = RoleManager.Instance.allPeopleList[i];
            ActionSetting      actionSetting = DataTable.FindActionSetting(people.protoData.ChoosedActionId);
            List <List <int> > proChange     = CommonUtil.SplitCfg(actionSetting.proChange);

            for (int j = 0; j < proChange.Count; j++)
            {
                List <int> singleChange = proChange[j];
                if (singleChange[1] > 0)
                {
                    RoleManager.Instance.AddProperty((PropertyIdType)singleChange[0], singleChange[1], people.protoData);
                    if (people.protoData.OnlyId == RoleManager.Instance.playerPeople.protoData.OnlyId)
                    {
                        AwardData award = new AwardData(AwardType.Property, singleChange[0], singleChange[1]);

                        //singlePropertyData.PropertyId = singleChange[0];
                        //singlePropertyData.PropertyNum = singleChange[1];
                        awardList.Add(award);
                    }
                }
            }
        }
        Action backHome = delegate
        {
            GameModuleManager.Instance.InitGameModule(GameModuleType.Home);
        };

        PanelManager.Instance.OpenPanel <GetAwardPanel>(PanelManager.Instance.trans_layer2, awardList, backHome, null);
        //for(int i=0;i<)
    }
Beispiel #10
0
    public Image img_bar;                 //bar


    public override void Init(params object[] args)
    {
        Clear();
        curActionPlanList = args[0] as List <Plan>;

        int actionId = curActionPlanList[0].actionId;

        ActionSetting actionSetting = DataTable.FindActionSetting(actionId);
        BigMapSetting bigMapSetting = DataTable.FindBigMapSetting(actionSetting.bigMapId.ToInt32());

        EventCenter.Register(TheEventType.ActionProcess, OnActionProcess);
        EventCenter.Register(TheEventType.ActionPause, ActionPause);

        img.sprite = ResourceManager.Instance.GetObj <Sprite>(ConstantVal.actionSceneFolderPath + bigMapSetting.sceneImgName);//  action.sprt;
        GenerateActionListPeople(curActionPlanList);
        //btn_backClas sRoom.onClick.RemoveAllListeners();
        //btn_backClassRoom.onClick.AddListener(() =>
        //{
        //    NewBehaviourScript.Instance.BackClassRoom();
        //});

        addBtnListener(btn_backClassRoom, () => GameModuleManager.Instance.ChangeGameModule(GameModuleType.BigMap));
        addBtnListener(btn_continue, () =>
        {
            GameActionManager.Instance.ContinueAction();
        });
        trans_grid.gameObject.SetActive(false);
        btn_continue.gameObject.SetActive(false);
        //如果是图书馆,则直接弹考试界面

        if ((ActionType)RoleManager.Instance._CurGameInfo.PlayerPeople.ChoosedActionId
            == ActionType.GoLibraryStudy)
        {
            PanelManager.Instance.OpenPanel <ExamPreparePanel>(PanelManager.Instance.trans_layer2);
        }
    }
Beispiel #11
0
        private void DisplayShapeInfo(Shape shape)
        {
            string textFrame  = "";
            string textFrame2 = "";
            string Id         = "";
            string name       = "";
            string dashStyle  = "";
            string BackColor  = "";
            string foreColor  = "";

            try
            {
                Id = shape.Id.ToString();
            }
            catch (Exception ex)
            {
                Id = "<No Id>";
            }

            try
            {
                name = shape.Name;
            }
            catch (Exception ex)
            {
                name = "<No Name>";
            }

            try
            {
                dashStyle = shape.Line.DashStyle.ToString();
            }
            catch (Exception ex)
            {
                dashStyle = "<No DashStyle>";
            }

            try
            {
                BackColor = shape.Fill.BackColor.RGB.ToString();
            }
            catch (Exception ex)
            {
                BackColor = "<No BackColor>";
            }

            try
            {
                foreColor = shape.Fill.ForeColor.RGB.ToString();
            }
            catch (Exception ex)
            {
                foreColor = "<No ForeColor>";
            }

            string textFrameHyperlinkAddress    = "";
            string textFrameHyperlinkSubAddress = "";

            try
            {
                if (shape.TextFrame.HasText == Microsoft.Office.Core.MsoTriState.msoTrue)
                {
                    //textFrame = shape.TextFrame.TextRange.Text;
                    TextRange txtRange = shape.TextFrame.TextRange;

                    textFrame = txtRange.Text;

                    Hyperlink txtFrameHyperlink = txtRange.ActionSettings[PpMouseActivation.ppMouseClick].Hyperlink;

                    textFrameHyperlinkAddress = txtFrameHyperlink.Address != null?txtFrameHyperlink.Address.ToString() : "null";

                    textFrameHyperlinkSubAddress = txtFrameHyperlink.SubAddress != null?txtFrameHyperlink.SubAddress.ToString() : "null";
                }
                else
                {
                    textFrame = "";
                }
            }
            catch (Exception ex)
            {
                Common.WriteToDebugWindow("ex shape.TextFrame.HasText");
            }

            string textFrame2HyperlinkAddress;
            string textFrame2HyperlinkSubAddress;

            try
            {
                if (shape.TextFrame2.HasText == Microsoft.Office.Core.MsoTriState.msoTrue)
                {
                    Microsoft.Office.Core.TextRange2 txtRange2 = shape.TextFrame2.TextRange;

                    textFrame2 = txtRange2.Text;

                    //Hyperlink txtFrame2Hyperlink = txtRange2.ActionSettings[PpMouseActivation.ppMouseClick].Hyperlink;

                    //textFrame2HyperlinkAddress = txtFrame2Hyperlink.Address != null ? txtFrame2Hyperlink.Address.ToString() : "null";
                    //textFrame2HyperlinkSubAddress = txtFrame2Hyperlink.SubAddress != null ? txtFrame2Hyperlink.SubAddress.ToString() : "null";
                }
                else
                {
                    textFrame2 = "";
                }
            }
            catch (Exception ex)
            {
                Common.WriteToDebugWindow("ex shape.TextFrame2.HasText");
            }

            ActionSetting mouseClick = shape.ActionSettings[PpMouseActivation.ppMouseClick];
            ActionSetting mouseOver  = shape.ActionSettings[PpMouseActivation.ppMouseOver];

            Hyperlink hyperlink = mouseClick.Hyperlink;


            string hyperLinkAddress = hyperlink.Address != null?hyperlink.Address.ToString() : "null";

            string hyperLinkSubAddress = hyperlink.SubAddress != null?hyperlink.SubAddress.ToString() : "null";

            string hyperLinkType = hyperlink.Type.ToString();

            Common.WriteToWatchWindow(string.Format("Id:{0,-6}  Name:{1,-20}  ForeColor:{2,-10}  BackColor:{3,-10}   DashStyle:{4,-10}   TextFrame:{5,-20}   TextFrame2:{6,-20}",
                                                    Id, name, foreColor, BackColor, dashStyle, textFrame, textFrame2));

            Common.WriteToWatchWindow(string.Format("Id:{0,-6}  textFrameHyperlinkAddress:{1,-20}  textFrameHyperlinkSubAddress:{2,-10}",
                                                    Id, textFrameHyperlinkAddress, textFrameHyperlinkSubAddress));

            Common.WriteToWatchWindow(string.Format("Id:{0,-6}  hyperLinkAddress:{1,-20}  hyperLinkSubAddress:{2,-10}  hyperLinkType:{3,-10}",
                                                    Id, hyperLinkAddress, hyperLinkSubAddress, hyperLinkType));
        }
Beispiel #12
0
    public Button btn_reply;//回复按钮
    public override void Init(object[] args)
    {
        base.Init(args);

        oneChatData = args[0] as OneChatData;
        //bool isPlayer = false;
        People people = RoleManager.Instance.FindPeopleWithOnlyId(oneChatData.Belong);

        txt_content.SetText(oneChatData.Content);

        SetHeight();
        if (!oneChatData.IsPlayer)
        {
            //txt_name.gameObject.SetActive(true);
            img_icon.transform.SetParent(trans_enemyHeadPos, false);
            img_icon.transform.localPosition = Vector2.zero;
        }
        else
        {
            // txt_name.gameObject.SetActive(false);
            img_icon.transform.SetParent(trans_myHeadPos, false);

            img_icon.transform.localPosition = Vector2.zero;
        }

        switch (oneChatData.ChatType)
        {
        case (int)WetalkMsgType.InviteAction:
            if (oneChatData.Valid)
            {
                btn_reply.gameObject.SetActive(true);
            }
            else
            {
                btn_reply.gameObject.SetActive(false);
            }

            break;

        default:

            btn_reply.gameObject.SetActive(false);
            break;
        }

        addBtnListener(btn_reply, () =>
        {
            switch (oneChatData.ChatType)
            {
            case (int)WetalkMsgType.InviteAction:
                ActionSetting actionSetting = DataTable.FindActionSetting(oneChatData.InviteActionId);
                PanelManager.Instance.OpenCommonHint("是否答应和" + people.protoData.Name + actionSetting.name + "?"
                                                     , () =>
                {
                    SocializationManager.Instance.ApplyInvite(people);
                },
                                                     null,
                                                     "答应",
                                                     "拒绝");
                break;

            default:
                break;
            }
        });
    }
Beispiel #13
0
 public AnimationBehavior(PlayMode m, ActionSetting info)
 {
     playMode   = m;
     actionInfo = info;
 }